Hi mate I am using pageview “JakeWharton-lib”,
I saw an example on web, and in some example used factory method to create fragment.
@Override
public Fragment getItem(int position) {
return TestFragment.newInstance(CONTENT[position % CONTENT.length]);
}
and in other example use Fragment.Instantiate(…)
what is the difference ?
newInstanceis not a part of Fragments API, it’s a convenience helper method. It can have whatever signature is convenient in a particular case. Whereasinstantiateis a part of API. It has a fixed signature.