Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.support.annotation.LayoutRes; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class Main { public static View inflate(@NonNull Context context, @NonNull ViewGroup parent, @LayoutRes int layoutRes) { return LayoutInflater.from(context).inflate(layoutRes, parent, false); } public static View inflate(@NonNull ViewGroup parent, @LayoutRes int layoutRes) { return inflate(parent.getContext(), parent, layoutRes); } }