• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding OnsaveInstanceState() and onRestoreInstanceState()

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!!
https://www.youtube.com/watch?v=3FMn4FEv12M
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic