Question about the lifecycle of a simple Android application
        Posted  
        
            by jul
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by jul
        
        
        
        Published on 2010-06-13T11:55:03Z
        Indexed on 
            2010/06/13
            12:02 UTC
        
        
        Read the original article
        Hit count: 315
        
Hi,
I've got a simple application with 3 activities: -the first contains a search box which calls a web service and show the results (restaurants) below in a listview -when a restaurant is clicked another activity is started showing the description of the restaurant and a button "show map" -when the button "show map" is clicked, guess what, the map is shown in a third activity.
All the data is loaded in the first activity by a web service (restaurant descriptions and coordinates), and data required by each activity is passed in a bundle using "intent.putExtra".
Now everything seems to run smoothly when clicking on the back button (eg. clicking on the back button from the map resumes the "restaurant description" activity with all data set properly), while I haven't done anything about the lifecycle yet.
Why? Are all variables saved automatically? Should I use onSaveInstanceState() and onRestoreInstanceState() anyway?
Thanks
Jul
© Stack Overflow or respective owner