Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an Android app that lets the user choose a city from a drop-down list using a spinner, and when the user selects a city,

Create an Android app that lets the user choose a city from a drop-down list using a spinner, and when the user selects a city, it starts a new activity that displays information about the selected city, such as an image, its weather and population, using explicit intent?

Here are the steps to create the app:

Create a new Android project in Android Studio.

1. Design the main layout of the app to include a spinner widget

a. (Create a gradient with colors of your own choice and set that as a background for your app layout)

b. Set the size of the spinner that looks pretty on the screen

2. Create an array of 10 popular cities of Canada to be used to populate the spinner.

3. Create a new activity that will display information about the selected city (atleast 3 cities)

4. Add an OnItemSelectedListener to the spinner to listen for item selection events.

a. In the onItemSelected method of the listener, create an explicit intent to start the new activity and pass the selected city as an extra and display the name of the city selected at the top of the second activity

5. Start the new activity using the startActivity method.

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_2

Step: 3

blur-text-image_3

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions