Actually, I always reused my view in my fragments like the following:
private View mView = null;
@Override
public View onCreateView(LayoutInflater inflater, Vie
I'm currently reusing the view with something like this:
if(view == null){
view = (ViewGroup) inflater.inflate(R.layout.news_list, container, false);
} else {
((ViewGroup) view.getParent()).removeView(view);
}
return view;
I don't know if this way is correct, but it seems to work for me..
NOTE: I'm using this aproach because I have a listview in a fragment, and when user tap on an item it loads a new fragment (fragment manager replace current list fragment using). Then, when user hit backbutton, as I'm reusing the same old view of the fragment (that is not destroyed when removed with FM) then the user continues viewing the list in the position it was before opening detail fragment view.