0

I am developing an Android application. There is a activity form. The user is going to fill out the form. To fill out the form the user need to go to other forms and after getting back the form is reloading.

I want the form to resume, not to re-create.

pb2q
  • 58,613
  • 19
  • 146
  • 147
roconmachine
  • 1,876
  • 2
  • 17
  • 24

3 Answers3

0

may help you also: http://developer.android.com/reference/android/app/Activity.html

@Override
public void onResume(){

    // put your code here...

}
jibbajava
  • 17
  • 1
  • 2
  • 6
0

This is correct behavior, according to the documentation. You will want to override onSaveInstanceState() to save what the Activity currently looks like, and then properly recreate it in onCreate().

Do this well, and your app will be rock solid. Some folks will generally recommend certain lazy short cuts which are not recommended and will in some cases lead to very unstable applications.

323go
  • 14,143
  • 6
  • 33
  • 41
0

There are two ways you can do this:

  1. Use startActivityForResult() , It will start another activity (means new forms etc) and then you will return back to original activity without any recreation of views and elements. You can do your stuff in onActivityResult() See How to manage `startActivityForResult` on Android?

  2. Or save your data in onSaveInstanceState() before leaving to activity and on returning back reload data. see this thread for further help onSaveInstanceState () and onRestoreInstanceState ()

Community
  • 1
  • 1
Androider
  • 2,884
  • 5
  • 28
  • 47