Reputation: 787
Activity Startup shows a dialogue for edit or add new like in the snapshot
i have an activity like a user form , there is button to add signature of user which takes user to the next activity when signature was done then on button click on "Done" app jumps back to the user form activity but oncreate method is called of user form activity so all the data lost that was entered before going to the signature activity. it ahows Dialoguge box again
i use finish()
after saving the signature but it reloads the previous activity.
i also use onBackPressed()
, it works for cancel button but not for save button.
if i do save and call onBackPressed()
it also reloads the user form activity, but if i just go to signature activity and press cancel button onBackPressed()
works fine for this and also finish() works.
any suggestion please
i checked finishActivity()
but it also not working
i just want that if i goto signature activity and return back the dialogue of edit or add new doesn't show. please help!
Upvotes: 1
Views: 2077
Reputation: 5973
You need to save the state of the activity to do that ..
override onSaveInstanceState(Bundle savedInstanceState)
and write the values you want to save, and receive them by overriding onRestoreInstanceState()
You can read more from this SO Question.
Use parcelable
if you have lots of values.. This SO question was very usefull to me.
Upvotes: 1