Changes

Jump to: navigation, search

Android Explicit Intents – A Worked Example

30 bytes added, 19:54, 1 July 2013
Creating the User Interface for ActivityB
Now that a class file has been created for ActivityB, the next step is to add an XML layout file for the user interface. To achieve this, right-click on the ExplicitIntent project and select the File -> New -> Android XML File menu option. In the resulting dialog, make sure the Resource Type is set to Layout, name the file activity_b.xml and choose the RelativeLayout view as the Root Element. Clicking on the Finish button will create the new resource file.
 
<google>BUY_ANDROID</google>
The only elements that are required for the user interface of the second activity are an EditText, TextView and Button view. With these requirements in mind, load activity_b.xml into the XML editor and modify it as follows, either manually by directly inputting the following XML or visually using the Graphical Layout tool. Note that the input style on the TextView component has been set to Text and that the text on the button has been assigned to a string resource named answer_text:

Navigation menu