Closed ppamorim closed 9 years ago
Hi, @ppamorim
Should use the v13 of utility.
//Optional: see how to use the utility.
compile 'com.ogaclejapan.smarttablayout:utils-v13:1.1.1@aar'
Sorry mistake.
Do not support because unnecessary instance.
@ogaclejapan Based on what you said that?
Hi, @ppamorim
Fragment instance repeat creation and destruction on the ViewPager.
So, I think it is better to use the Fragment.instantiate(...)
rather than give an instance.
You're wrong. Only the view will be recreate, not a instance of the fragment. I use the instance of the Fragment a long time on my applications.
Please try checked Don’t keep activities in the developer mode. When you view again after returning to the home, it will change to a different instance. Often occurs is similar events in low memory device.
@Override
public Object instantiateItem(ViewGroup container, int position) {
Object item = super.instantiateItem(container, position);
Log.d("DEBUG", "position: " + position + " " + item.toString());
if (item instanceof Fragment) {
mHolder.put(position, new WeakReference<Fragment>((Fragment) item));
}
return item;
}
Hi, @ppamorim Thank you upload the code.
What are the reasons why you think you have the better of this code than the current implementation? I think enough in the current implementation to be instantiated when needed.
The library utility that provides adapters is optional, if you want to use the adapter that you have pre-instantiation, please use to implement yourself.
Although I'm sorry, Function to add a pre-instantiated fragment does not have plans to add to the utility.
How to do this?
Solved!
This can be a problem:
I need to have a:
Why, If I need create a instance of the Fragment, I need use this.