Search code examples
androidnavigationloadback

How to load the values for edittext fields when back button is pressed


I have three pages for user registration. I implemented this using intents.For each page I have next button to navigate to next page.I have to save all the details at the 3rd page when clicking the submit button.I have back button in action bar to go forth to the pages.Its all working fine. But now my problem is when I go back to the pages it shows empty fields.But I want to know how to make that fields to be filled.Can anyone help me out for this?


Solution

  • Just try with finish()

    While moving from 1st activity to 2nd activity, don't call finish().In 2nd Activity while clicking back menu just call finish()

    @Override
        public boolean onOptionsItemSelected(MenuItem item) {
                switch (item.getItemId()) {
                case R.id.back_btn: //your back btn id
                       finish();
    
                }
                return true;
        }