Java tutorial
//package com.java2s; //License from project: Apache License import android.view.LayoutInflater; import java.lang.reflect.Field; public class Main { public static void injectLayoutInflater(LayoutInflater layoutInflater, Object src, Class clz, String name) { try { Field field = clz.getDeclaredField(name); field.setAccessible(true); field.set(src, layoutInflater); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } }