Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.view.LayoutInflater; import android.view.View; public class Main { private static final int INVALID = -1; public static View getView(Context context, int resourceId) { LayoutInflater inflater = LayoutInflater.from(context); if (resourceId != INVALID) { return inflater.inflate(resourceId, null); } return null; } }