1/3

Android Assignment

Using Intents

Please conduct the following tasks alone. For implementation details you can refer to the lecture slides or the Android developer website. Please do not hesitate to ask me or the tutor if you have any questions. Under „Tip“ you can find some hints for the task. The „Checklist“ specifies what should happen when your implementation is correct.

2/3

Tasks

  1. Use an implicit Intent to dial a number
  2. Start a second Activity using an explicit Intent
  3. Transfer data between Activities
3/3

1. Use an implicit Intent to dial a number

Open your existing example application that you created in the last assignment. When the button is touched, the app shall use an implicit Intent to open the Android Dialer app to call a given number.

center 30%

Checklist
When the button is pressed the Dial-dialog opens.

2. Start a second Activity using an explicit Intent

Now add a second activity to your project and call it „Detail“. Start the new Activity when the button on the first Activity is touched by using an explicit Intent.

Tip

To create a new Activity, select „New“->“Activity“->“Empty Activity“ from the menu. Check if the Java class „Detail.java“ and the layout file „activity_detail“ are created and if the new Activity is registered in the „AndroidManifest.xml“.

Checklist
When the Button is touched, the second Activity is started

3. Transfer data between Activities

Edit your „activity_main“ layout file and add a plain TextField to type in text. Now add the following functionality: The text that is typed into the TextField in the first „Main“-Activity is shown in the TextView of the second „Detail“Activity, when the user touches the Button (see screenshots below).

center 60%

Tip

Use the putExtra() method of the Intent class to transfer the text from your „Main“- to your „Detail“-Activity. Get the TextView in the „Detail“-Activity by using the findViewById() Method. You might need to give the TextView an Id first.

Checklist
When the button is touched, the Detail Activity is started showing the typed in text from the Main Activity.