Reputation: 1362
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 ?
Upvotes: 0
Views: 204
Reputation: 48262
newInstance
is not a part of Fragments API, it's a convenience helper method. It can have whatever signature is convenient in a particular case. Whereas instantiate
is a part of API. It has a fixed signature.
Upvotes: 1