Sabtu, 27 April 2013

handle DialogFragment with orientaion change

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();
    }


0 komentar:

Posting Komentar

Copyright © 2012 Codding News All Right Reserved