To handle DialogFragment with orientaion change:
- Override onActivityCreated() to call setRetainInstance(true)
Example:
@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);
setRetainInstance(true);
}
- Override onDestroyView() to dismiss message quere
Example:
@Override
public void onDestroyView() {
if (getDialog() != null && getRetainInstance()){
getDialog().setDismissMessage(null);
}
super.onDestroyView();
}
No comments:
Post a Comment