Lecture 4 - Calling Sub-Activities 2

home | previous | next

Overview

Today, we practise transitioning between activities and learn how to use CheckBox and RadioButton.

Resources

Links

Sending and Retrieving Data with Sub-activities

Exercise 4.1

Download the above resource file.
Study how Toast widget works ('ShowToast' project).

Exercise 4.2

Study how to read an image file in assets folder and show the image on ImageView widget ('ShowImage' project).

Exercise 4.3

Copy the 'ShowImage' project as a new project.
Add an EditText widget.
When a user types 'apple' in the EditText widget and click the button, let the user move to the second activity to show an apple image.
If the data the user typed is not 'apple', show a Toast message that you can't show the image.

Exercise 4.4

Use the same project (exercise 4.3).
Add the banana and coconut image to the second acitivity.
When a user types 'apple', 'banana' or 'coconut' in the EditText widget and click the button, let the user move to the second activity to show an appropriate image.
If the name of an image the user typed is not available, show a Toast message that you can't show the image.

Exercise 4.5

Use the above project (exercise 4.4).
Add EditText and Button widets to the second acitivity.
When a user types a number and clicks the button in the second activity, go back to the first activity and show the number.

CheckBox and RadioButton

Exercise 4.6

Study how to get a choice with CheckBox widget. ('CheckSimple' project).

Exercise 4.7

Use the above project. Offer more options to users and display the result users have chosen.

Exercise 4.8

Study how to get a choice from multiple options with RadioButton widget. ('RadioSimple' project).

Exercise 4.9

Use the above project. Make another option group and show how to manage multiple radio button groups.

Exercise 4.10

Make a new project which use CheckBox and RadioButton widgets together.