Java tutorial
//package com.java2s; import android.content.Context; import android.support.annotation.LayoutRes; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class Main { public static View inflate(Context context, @LayoutRes int layoutId) { return inflate(context, layoutId, null); } public static View inflate(Context context, @LayoutRes int layoutId, ViewGroup parent) { return inflate(context, layoutId, parent, false); } public static View inflate(Context context, @LayoutRes int layoutId, ViewGroup parent, boolean attatch) { return getInflater(context).inflate(layoutId, parent, attatch); } public static LayoutInflater getInflater(Context context) { return LayoutInflater.from(context); } }