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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Murach Android Programming" Watch "Murach Android Programming" New topic

Murach Android Programming

Willie Smith

Joined: Nov 19, 2013
Posts: 2

I don't know if I missed it, but basically this is a question for Joe Murach, or anybody who has the capability to answer this question. I bought the book last week Thursday and I am already up to Chapter 8, in reading. So my question is, with the Tip Calculator App, how can I get the widgets like the SeekBar, Spinner and the Radio Buttons to be set to default values, when a user exits the app by pressing the back button, then clicks the app icon to start the app again. For instance every time I start the app I would want the none radio button selected, no split and 10% to be displayed every time. As it is now, when you exit the app and restart it widgets have selected the previous states that is had before ending the app.

Greg Charles

Joined: Oct 01, 2001
Posts: 2969

Hi Willie, and welcome to CodeRanch!

Wow, you read extremely fast compared to me. It took me weeks to get through chapter 8! Based on my still limited understanding of Android, settings are save and restored via the SharedPreferences class, described on page 106. If you don't want that to happen for some settings, just take out the part where they're saved in the onPause() method and restored in the onResume() method.
Willie Smith

Joined: Nov 19, 2013
Posts: 2
Thanks Greg,

Ha ha, that makes since, let me look at how they are saved and retrieved, I was pulling my hair out over this, but that makes a lot of since. By the way thanks for the welcome, I have been programming for 10 years with two in Java and Android and some of this is still new to me, but this book is a really good resource.
I agree. Here's the link:
subject: Murach Android Programming
jQuery in Action, 3rd edition