Android Lesson 2: Activities

Referensi: https://google-developer-training.gitbooks.io/android-developer-fundamentals-course-practicals/content/en/Unit%201/21_p_create_and_start_activities.html

2.1 Create and Start Activities

Task 1. Create the TwoActivities project
1.1 Create the TwoActivities project

1.2 Define the layout for the main activity

1.3 Define the button action

Task 2. Create and launch the second activity
2.1 Create the second activity

2.2 Modify the Android manifest


2.3 Define the layout for the second activity


2.4 Add an intent to the main activity

Task 3. Send data from the main activity to the second activity
3.1 Add an EditText to the main activity layout


3.2 Add a string to the main activity’s intent extras


3.3 Add a TextView to the second activity for the message


3.4 Modify the second activity to get the extras and display the message

Task 4. Return data back to the main activity
4.1 Add an EditText and a Button to the second activity layout


4.2 Create a response intent in the second activity


4.3 Add TextViews to the main activity layout to display the reply


4.4 Get the reply from the intent extra and display it

 

2.2: Activity Lifecycle and Instance State

Task 1. Add lifecycle callbacks to TwoActivities
1.1 (Optional) Copy the TwoActivities Project
1.2 Implement callbacks in to MainActivity


1.3 Implement lifecycle callbacks in SecondActivity

1.4 Observe the log as the app runs

Task 2. Save and restore activity state
2.1 Save the activity instance state with onSaveInstanceState()
2.2 Restore the activity instance state in onCreate()

2.3: Start Activities with Implicit Intents
Task 1. Create new project and layout
1.1 Create the project


1.2 Create the layout


Task 2. Implement open website
2.1 Define the openWebsite method


Task 3. Implement open location
3.1 Define the openLocation method


Task 4. Implement share this text
4.1 Implement the shareText method

Task 5. Receive implicit intents

Leave a Reply

Your email address will not be published. Required fields are marked *