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.
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.
Checklist | |
---|---|
When the button is pressed the Dial-dialog opens. |
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.
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 |
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).
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. |