Run the app

Add up navigation


Each screen in your app that is not the main entrance (all screens that are not the "home" screen) should provide navigation so the user can return to the logical parent screen in the app hierarchy by tapping the Up button in the app bar.
All you need to do is declare which activity is the logical parent in the AndroidManifest.xml file. So open the file at app > Manifests > AndroidManifest.xml, locate the <activity> tag for DisplayMessageActivity and replace it with the following:
<activity android:name=".DisplayMessageActivity"
          android:parentActivityName=".MainActivity" >
    <!-- The meta-data tag is required if you support API level 15 and lower -->
    <meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value=".MainActivity" />
</activity>
The Android system now automatically adds the Up button in the app bar.

Run the app


Now run the app again by clicking Apply Changes  in the toolbar. When it opens, type a message in the text field, and tap Send to see the message appear in the second activity.
Figure 2. Screenshots of both activities


That's it, you've built your first Android app!

Comments

  1. You have done great work. keep continue to sharing such kinds of post. Keep it up....

    Want to make custom website & application? Click here:

    Android Mobile App Development
    Android Application Development
    iOS Application Development

    ReplyDelete

Post a Comment

Popular posts from this blog

Make the text box size flexible

Change the UI strings

Add Text box & Button