There is a way to get layoutInflater:
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
and
The only difference is the context that you use. If the context that you use with LayoutInflater.fromContext()
or context.getSystemService(...)
is actually an Activity, it should be equivalent to Activity.getLayoutInflater()
. If it's the application object, you might have problems inflating views that contain fragments, IIRC.