File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Android and the fly likes Regarding OnsaveInstanceState() and onRestoreInstanceState() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Regarding OnsaveInstanceState() and onRestoreInstanceState()" Watch "Regarding OnsaveInstanceState() and onRestoreInstanceState()" New topic

Regarding OnsaveInstanceState() and onRestoreInstanceState()

kiruthigha rajan
Ranch Hand

Joined: Dec 29, 2011
Posts: 69
Hi im new to Android can anyone please tell me what does these two methods mean (OnsaveInstanceState() and onRestoreInstanceState() ).
and what is the purpose of using these methods...
Thanks in advance
Adnan Am

Joined: Sep 14, 2012
Posts: 2
onSaveInstanceState() is a method used to store data before Pausing the activity & onRestoreInstanceState() is method used to retrieve that data back.

Consider this example here:

You app has 3 edit boxes where user was putting in some info , but he gets a call so if you didnt use the above methods what all he entered will be lost.

So always save the current data in onPause() method of Activity as a bundle & in onResume() method call the onRestoreInstanceState() method . !

Hope this helped
ankush deshpande

Joined: Mar 17, 2013
Posts: 2
hey Rajan...
i am also a beginner in android programming. I refer to Slidenerd on Youtube for programming on Android. Hope this video helps you. cheeres!!!
I agree. Here's the link:
subject: Regarding OnsaveInstanceState() and onRestoreInstanceState()
It's not a secret anymore!