05 Prove
Activities and Intents
Objectives
Create your own Android application.
Assignment
Part I (46.5%) - Communicating Between Activities:
-
Create a new Android project.
-
The main activity should have a label asking the user to enter their favorite scripture. It should provide separate input boxes for the Book, chapter, and verse values.
-
Add a button to your first activity that when tapped, will create an Intent, store the user's scripture information in the intent, and then use the Intent to invoke a second Activity.
-
The second Activity should display the information in the traditional format: Book Chapter:Verse.
Part II (46.5%) - Debug Logging:
-
Add a debug log message to the first activity's button handler code that is invoked before the intent is created. This message should say something like: "About to create intent with John 3:16.
-
Add another message to the second activity in the
onCreate
function. It should log a message like: "Received intent with John 3:16". -
Use the logcat tab in Android Studio to find your messages.
🌟Stretch Challenge (7%)🌟
-
Modify your application so that it has a button on the second activity labeled "Save Scripture".
When tapped, that button should store the Book, chapter, and verse values in the user's Shared Preferences.
A Toast should appear, informing the user that the scripture was saved successfully.
-
Add a new button to the first activity labeled "Load Scripture".
When tapped, that button should load the Book, chapter, and verse values from the user's Shared Preferences and populate the text fields with those values.