I am trying to save my View states in my fragment, but I am worried that I will skip my activity. That's what I'm doing:
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state){ if(mView != null){ View oldParent = mView.getParent(); if(oldParent != container){ ((ViewGroup)oldParent).removeView(mView); } return mView; } else{ mView = inflater.inflate(R.id.fragview, null) return mView; } }
I am worried that I know that all views are held in context, and I do not know if this is an Activity context or an application context if it is swollen from a blower. Perhaps it would be a better idea to pragmatically create a view and set its attributes using getActivity (). GetApplication (), not use a blower. I would appreciate any feedback on this.
Thanks!
EDIT: A confirmed activity leak, although this code works fine, don't do this: * (
android memory-leaks android-fragments android-support-library
schwiz
source share