Click here to Skip to main content
15,900,108 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have problem with my android app. Actually the problem is lets say i have a Activity with some textBoxes and i have entered some values in to them. Now i pressed home button on android emulator keypad. Now i ll be on the home page. And when i reopen my application it is getting started freshly ( from onCreate() method). How can i see the values which were entered before pressing home button. Is there any way to restore those values?

Thank You
Yashwanth
Posted

 
Share this answer
 
Comments
YashwanthBathini 14-Nov-11 3:54am    
hi,
I have tried this but when i reopen the application it is starting as fresh. Am calling onSaveInstanceState() and onRestoreInstanceState() in addition to onCreate() method.. Do i need to add(Override) something else..Please clarify.

Thank you
Yashwanth
Darren_vms 14-Nov-11 6:11am    
You need to override onSaveInstanceState not call it and the same goes for onRestoreInstanceState.
onSaveInstanceState and onRestoreInstanceState
@ Override
protected void onSaveInstanceState (Bundle outState) {
outState.putString ("lastPath", "/ sdcard/android/ccopy/test");
}


@ Override
public void onRestoreInstanceState (Bundle savedInstanceState) {
super.onRestoreInstanceState (savedInstanceState);

String cwjString = savedInstanceState.getString ("lastPath");
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900