Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a basic mobile app sequence in this milestone. Ensure all steps have been completed and your code is functioning properly. Zip and upload the

Develop a basic mobile app sequence in this milestone. Ensure all steps have been completed and your code is functioning properly. Zip and upload the developed milestone.To create the second activity, follow these steps:
In the Project window, right-click the app folder and select New > Activity > Empty Activity.
In the Configure Activity window, enter "DisplayMessageActivity" for Activity Name. Leave all
other properties set to their defaults and click Finish.
Android Studio automatically does three things:
Creates the DisplayMessageActivity file.
Creates the layout file activity_display_message.xml, which corresponds with
the DisplayMessageActivity file.
Adds the required at the top of the layout.
The new activity includes a blank layout file, Follow these steps to add a text view to where the message
appears:
Open the file app > res > layout > activity_display_message.xml.
Click Enable Autoconnection to Parent
in the toolbar. This enables Autoconnect. See
figure 1.
In the Palette panel, click Text, drag a TextVlew into the layout, and drop it near the top-center
of the layout so that it snaps to the vertical line that appears. Autoconnect adds left and right
constraints in order to place the view in the horizontal center.
Create one more constraint from the top of the text view to the top of the layout, so that it
appears as shown in figure 1.
Optionally, you can make some adjustments to the text style if you expand textAppearance in
the Common Attributes panel of the Attributes window, and change attributes such
as textSize and textColor.
Display the message
In this step, you modify the second activity to display the message that was passed by the first activity.
In DisplayMessageActivity, add the following code to the amCreated) method:
KotlinJava
override
protected void onCreate(Bundle savedinstanceState){
super.onCreate(savedinstanceState);
setContentView/R.layout.activity_display_message);
// Get the Intent that started this activity and extract the string
Intent intent = getintent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
// Capture the layout's TextView and set the string as its text
TextView textView = findViewByld(R.id.textView);
textView.setText(message);Press Alt+Enter, or Option+Return on a Mac, to import these other needed classes:
Kotlinuava
import androidx,.appcompat.app.AppCompatActivity;
import android.content. Intent;
import android.os. Bundle;
import android. widget. Text View;
Add upward navigation
Each screen in your app that's not the main entry point, which are all the screens that aren't the home
screen, must provide navigation that directs the user to the logical parent screen in the app's hierarchy.
To do this, add an Up button in the app ba.
To add an Up button, you need to declare which activity is the logical parent in
the AndroidManifest.xml file. Open the filc at app > manifests > AndroidManifest.xml, locate
the sactivity: tas for DisplayMessageActivity, and replace it with the following:
The Android system now automatically adds the Up button to the app bar.
Run the app
Click Apply Changes in the toolbar to run the app. When it opens, type aurmessage in the text field
and tap Send to see the message appear in the second activity:Figure 2. App opened, with text entered on the left screen and displayed on the right.
That's it, you've built your first Android appl
When you are done, zip the project and submit it under the assigned bin.
Note: it is very important that you submit the project as a zip file in order to be uploaded.
KB

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

making a grocery list python

Answered: 1 week ago

Question

Describe the linkages between HRM and strategy formulation. page 74

Answered: 1 week ago

Question

Identify approaches to improving retention rates.

Answered: 1 week ago