Changes

Jump to: navigation, search

Android Explicit Intents – A Worked Example

8 bytes removed, 20:10, 26 June 2013
no edit summary
<table border="0" cellspacing="0" width="100%">
<tr>
<td width="20%">[[An Overview of Android Intents|Previous]]<td align="center">[[Kindle Fire Android 4 App Development Essentials|Table of Contents]]<td width="20%" align="right">[[Android Implicit Intents – A Worked Example|Next]]</td>
<tr>
<td width="20%">An Overview of Android Intents<td align="center"><td width="20%" align="right">Android Implicit Intents – A Worked Example</td>
<google>BUY_KINDLE_FIREBUY_ANDROID</google>
As covered in An Overview and Example of Android Event Handling, the android:onClick="onClick" resource line in the above XML file uses an alternative way to handle simple click events without having to implement an event listener in the Java code of the activity. By specifying the onClick event type and the method to be called when such an event is detected, it is quick and easy to wire up basic click event handling on a view. Once the onClick() method has been implemented in the ActivityA.java file, it will be called whenever the button is touched by the user.
Once the layout is complete, the user interface should resemble that illustrated in Figure 2426-1:
[[Image:android_explicit_intent_activity1_ui2.png|The user interface for an Android Explicit Intent example]]
Figure 2426-1
</pre>
The completed layout should resemble that illustrated in Figure 2426-2:
[[Image:android_explicit_intent_activity2_ui2.png|The user interface for an Android Explicit Intent example]]
Figure 2426-2
</pre>
Compile and run the application either within an emulator or on a physical Kindle Fire Android device. Enter a question into the text box in ActivityA before touching the “Ask a Question” button. The question should now appear on the TextView component in the ActivityB user interface.
== Launching ActivityB as a Sub-Activity ==
<google>BUY_KINDLE_FIREBUY_ANDROID</google>
<table border="0" cellspacing="0" width="100%">
<tr>
<td width="20%">[[An Overview of Android Intents|Previous]]<td align="center">[[Kindle Fire Android 4 App Development Essentials|Table of Contents]]<td width="20%" align="right">[[Android Implicit Intents – A Worked Example|Next]]</td>
<tr>
<td width="20%">An Overview of Android Intents<td align="center"><td width="20%" align="right">Android Implicit Intents – A Worked Example</td>
</table>

Navigation menu