0

To resume the fragment press on backpress.On Backpress resume fragment in android.

I have the navigation drawer.fragment has replace from one layout to another. On back press want resume the fragment.

To resume the fragment:

public class ResumeFragment  extends Fragment {
View view;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    view = inflater.inflate(R.layout.puser_registration, null);

    Button btn_ok=(Button)view.findViewById(R.id.btn_ok);

    EditText edit_text=(EditText)view.findViewById(R.id.edit_text); 



    btn_ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            Ticket_generation fragment = new Ticket_generation();
            FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            fragmentTransaction.replace(R.id.drcontent_frame, fragment, "Second");
            fragmentTransaction.commit();
        }
    });

    return view;
}}

This fragment to resume in android.On back press resume the fragment in android.The edit edit value to stored.

jaya oriya
  • 83
  • 3
  • 17
  • 1
    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. – moritzg Jun 23 '17 at 06:09
  • if you resume the fragment then you can use fragmentTranscation.addToBackStack("yourtag") and you can also see https://stackoverflow.com/questions/18305945/how-to-resume-fragment-from-backstack-if-exists – Vij Jun 23 '17 at 06:40

1 Answers1

0

Try this to add below attribute in EditText in XML.

<EditText
        ...
        android:freezesText="true" 
/>
Nitin Patel
  • 1,605
  • 13
  • 31