Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Professional Android 2 Application Development
BOOK: Professional Android 2 Application Development
This is the forum to discuss the Wrox book Professional Android 2 Application Development, 2nd Edition by Reto Meier; ISBN: 978-0-470-56552-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 2 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 9th, 2010, 12:49 AM
Registered User
Join Date: Mar 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Confused between onSaveInstanceState and onPause on page 81 and 82

It might be SDK version differences that results in different application of onSaveInstanceState and onPause methods.

This is my understanding of onSaveInstanceState() and onPause(), backed up by the explanation on
found at 13 mins 50 sec mark.

1) onSaveInstanceState() is intended for the use to save UI states, I have no question about that.
2) onPause() is intended for the use to save persistent data (database, files.. etc), in other words.. data that should persist across application sessions.

If my understanding is correct, then shouldn't the comment in onStop() found on page 82
"Persist all edits or state changes ..." be moved to onPause() ?

Old March 9th, 2010, 09:26 AM
Reto's Avatar
Wrox Author
Join Date: Oct 2008
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts

You make a good point! In most circumstances you will want to persist all edits and state changes on onPause to ensure that they are saved should the runtime prematurely kill the application while it's paused.

In practice, a paused Activity may still be visible, so there is a chance that some of its state may have changed (though not through direct user interaction). It's also very unlikely that a paused Activity (rather than a stopped one) will be executed.

In general though, you're 100% correct. That comment would be better placed in the onPause method. Thanks for the feedback!
Reto Meier

Author, "Professional Android 4 Application Development", Wrox, ©2012, 2010, 2008

Similar Threads
Thread Thread Starter Forum Replies Last Post
onSaveInstanceState etc. Todd A BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 0 March 15th, 2009 04:18 PM
Confused About ManageArticles page pinch BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 October 14th, 2007 06:12 PM
Example code for EJB(ISBN:81-7366-351-3) akb_das Wrox Book Feedback 3 August 27th, 2004 03:49 PM
Exercise ch2, page 82 ssr All Other Wrox Books 2 September 10th, 2003 03:42 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.