Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this project, you are to build an application that has a main fragment (home screen) which will have three buttons and three images. When

For this project, you are to build an application that has a main fragment (home screen) which will have three buttons and three images. When you click on a button that will take you to the corresponding fragment, it will also pass the image using safeArgs from the main fragment to the fragment you selected with the button. Pressing the back button on the phone will take you back to the main fragment The project will consist of a main fragment and three fragments which the main fragment can navigate to. For the navigation, you will use the navigation component and you will use safeargs to pass the image. IMPORTANT: The book does not discuss how to pass an image. To do so you will need to set the argType to integer. app:argType="integer" And you will need to use the getTag and setTag methods for your image. Below is an example of mine. ImageView image3 = getView().findViewById(R.id.image_three); image3.setTag(R.drawable.android_image_3); int id3 = getDrawableId(image3); You will need to write the getDrawableId method. private int getDrawableId(ImageView iv) { return (Integer) iv.getTag(); } To set the image you will need to use the setImageResource(int) method image.setImageResource(imageRes); It is up to you to figure out where to put this method and setTag/getTag methods. But a hint is you are passing the image resource id (integer) from the main fragment to the one selected. You must pass the image id you cannot hardcode the image on the fragment that will result in a failing grade. You can hard code the title text. I expect all view landscape and portrait to not break when the phone is rotated. Also, there are to be no warnings or errors.

Screenshot of navigation graph

image text in transcribed

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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago