• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Murach Android Programming

 
Willie Smith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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.


Will
 
Greg Charles
Sheriff
Posts: 3002
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic