There is two public interfaces:
LayoutInflater.Factory
and LayoutInflater.Factory2
in android sdk, but official documentation can't say something helpfull about this interfaces, even LayoutInflater
documentation.
From sources I've understood that if Factory2
was set then it will be used and Factory
otherwise:
View view;
if (mFactory2 != null) {
view = mFactory2.onCreateView(parent, name, context, attrs);
} else if (mFactory != null) {
view = mFactory.onCreateView(name, context, attrs);
} else {
view = null;
}
setFactory2()
also have very laconic documentation:
/**
* Like {@link #setFactory}, but allows you to set a {@link Factory2}
* interface.
*/
public void setFactory2(Factory2 factory) {
Which factory should I use If I want to set custom factory to LayoutInflater
?
And what is the difference of them?