Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Exercises

1. Add a log message to the onCreate() method of each Activity class in your Have You Read That? application prototype. For example, add an informational log message such as “In Activity QuizSplashActivity” to the QuizSplashActivity class.

2. Add an additional application preference string to the application prototype: lastLaunch. In the onCreate() method of QuizSplashActivity class, make the following changes: Whenever this method runs, read the old value the lastLaunch preference and print its value to the log output. Then, update the preference with the current date and time.

Hints: The default Date class (java.util.Date) constructor can be used to get the current date and time, and the SimpleDateFormat class (java.text.SimpleDateFormat) can be used to format date and time information in various string formats. See the Android SDK for complete details on these classes.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint