import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
class Main {
static public View inflate(Context context, int layoutId) {
LayoutInflater vi = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
return vi.inflate(layoutId, null);
}
static public View inflate(Context context, int layoutId, View parent) {
View v = inflate(context, layoutId);
((ViewGroup) parent).addView(v);
return v;
}
static public View inflate(Activity context, int layoutId, int parentId) {
View v = inflate(context, layoutId);
((ViewGroup) context.findViewById(parentId)).addView(v);
return v;
}
}