Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make the navigation work for all activities in the app. Copy the navigation bar XML code to the layout associated with each activity. Copy the

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Make the navigation work for all activities in the app. Copy the navigation bar XML code to the layout associated with each activity. Copy the Java code that makes the buttons work to the Java file associated with each activity. You will have to modify that code to reference the activity it is in, rather than MainActivity. Add code to disable the ImageButton associated with the activity that is displayed LTE A My Contact List OFF SAVE Contact Enter Name Address Enter Street Address City Stat Zipcode Home Phone Cell Phone E Mail Address "d Birthday 01/01/1970 CHANGE ODO ESS: k?xml version="1.0" encoding="utf-8"?> droidx.constraint layout.widget.ConstraintLayout xmlns:android-"http://schemas.android.com/apk/res/android" xmlns:app "http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" tools: context-".MainActivity"> 26 NA 27 28 29 30 31 32 33 34 35 cor 36 37 cor 38 39 40 ra 41 42 B 43 44 45 46 lay 92 13 14 15 16 17 48 49 50 51 52 53 54 55 56 57 58 59 87 88 89 90 91 92 93 94 95 96 1 97 98 99 100 101 102 103 104 105 186 EditText android:id="@+id/editName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginstart-"16dp" android:layout_marginLeft="16dp" 107 108 169 X contact activity.contact map.xml select_date.xml x 3 1 anaroza: 1ayout_neignt= wrap_content android:layout_marginstart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="8dp" android:ems="14" android:input type="textPersonName" android:hint-"Enter Name app:layout_constraintStart_toStartOf="parent" app:layout_constraint Top_toBottomOf="@+id/textContact" android:imeOptions="actionNext"/> 2 3 4 5 8 9 2 -3 24 25 26 27 28 29 EditText android:id="@+id/editAddress" android:layout_width="wrap_content" 31 spring 2021 s.xml x activity_main.xml activity_contact_list.xml activity_contact_map.xml select_date.xml acti WICALVACH android:id="@+id/textAddress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp." android:layout_marginTop"16dp" android:text="Address: app:layout_constraintStart_toStartof="parent" app:layout_constraintTop_toBottomOf-"@+id/editName" /> colors.xml x activity_main.xml activity_contact_list.xml activity_contact_map.xml x select_date.xml x 58 59 android: hint-"Enter Street Address" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textAddress" android:imeOptions="actionNext"/> le 11 12 13 14 15 16 37 38 19 Edit Text android:id="@+id/editCity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart-"16dp" android:layout_marginLeft-"16dp" android:layout_marginTop="8dp" android:ems="9" android: hint-"City" .android: imeOptions="actionNext" android:input type="textCapWords" android: nextFocus Down="@id/editState" app:layout_constraintStart_toStartof -"parent" app:layout_constraintTop_toBottomof -"@+id/editAddress" /> 50 51 52 53 54 55 56 57 58 59 EditText android:id="@+id/editstate" android:layout_width="wrap_content" android:layout_height="wrap_content" 60 61 intado psc main res layout activity_main.xml activity_main.xml activity_contact_list.xml app D. Pixel Emulator Spring 2021 activity_contact_map.xml select_date.xml x colors.xml x activity 160 161 162 163 164 165 android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginstart="2dp" android:layout_marginLeft="2dp" android:layout_marginTop="8dp" android:ems"2" android:hint="State android:input type="textCapCharacters" android: maxlength="2" android:nextFocus Down="@id/editZipcode" app:layout_constraintStart_toEndOf="@+id/editCity" app:layout_constraintTop_toBottomOf="@+id/editAddress" /> 166 167 168 169 170 171 172 173 174 175 176 177 178 187 188 189 190 191 192 193 194 195 196 197 198 199 200 281 202 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 Edit Text android:id"@+id/editEmail" android:layout_width="wrap_content" android:layout_height="Wrap_content" android:layout_marginstart="16dp" android:layout_marginleft="16dp" android:layout_marginTop-"8dp" android: ems-"16" android:imeOptions-"actionNext" 249 250 251 297 activity contact map.xml select_date.xml x TE 250 1251 252 android:layout_marginTop="8dp" android:ems="16" android:imeOptions="actionNext" app:layout_constraintTop_toBottomOf="@id/textEmail" app:layout_constraintstart_toStartof="parent" /> 253 254 255 256 257 258 259 260 19261 of 262 263 Of 264 265 266 Ara 267 268 269 270 B 271 272 lay 273 274 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 elayout.widget.ConstraintLayout> o Contact Map Activity java X Pixelmulator Spring 2021 anydpi-v26Vic_launcher_found.xml anydpl-v26Vic launcher.xml ContactListActivity java package com.example.mycontactlist; 2 import androidx appcompat.app.AppCompatActivity import androidx.fragment.app.FragmentManager: MainActivityjov 9 10 import android.content. Intent; import android.os.Bundle; import android, text.format.DateFormat; import android.view.View; import android.widget.Button; Import android.widget.EditText; import android.widget.ImageButtons import android.widget.TextView; import android.widget.ToggleButton; 12 13 14 15 import java.util.Calendars 16 17 18 . public class MainActivity extends AppCompatActivity implements DatePickerDialog SaveDatelistener 19 20 21 of 22 23 24 25 26 @override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Device File Explore initListButton(); initMapButton(); initsettingsButton(); G Emulator 27 HABATAA 1+ CI Contact ustActivity Java x Contact Map Activityjava MainActiv setContentView(R.layout.activity_main); initlistButton(); initMapButton(); initSettingsButton(); initToggleButton(); setForEditing(false); initChangeDateButton(); B 1 } 2 3 14 35 37 38 39 10 A 42 43 private void initListButton() { ImageButton iblist- findViewById(R.id. imageButtonlist); iblist.setOnClickListener((view) Intent intent - new Intent( packageContext: MainActivity.this, ContactListActivity.class); intent.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); 3); } private void initMapButton() { ImageButton ibList - findViewById(R.id. imageButtonMap); iblist.setOnClickListener((view) { Intent intent - new Intent( packageContext: MainActivity, this, contactMapActivity.class); intent. setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); }); } private void initSettingsButton() { Event Log 44 45 47 48 49 50 a 52 53 Lay LITE O snares app 47 48 19 Build Run Tools VCS Window Help MyContactlist - MainActivityjava MyContactList.appl - Android Studio ole mycontactlist MainActivity D. Pixel Emulator Spring 2021 anydpi-v26\ic launcher_found.xml anydpl-v26\ic launcher.xml ContactListActivity.java Contact Map Activity java X MainActivity jave Intent intent- new Intent( packageContext: MainActivity.this, ContactMapActivity.class); intent. setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); 50 }); 52 } private void initSettingsButton() { ImageButton iblist - findViewById(R.id. imageButtonSettings); SS iblist.setOnClickListener((view) { Intent intent = new Intent( packageContext: MainActivity. this, contactSettingsActivity.class); 58 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); 53 54 57 59 60 }); 62 63 64 65 66 O 69 private void initToggleButton() { final ToggleButton editToggle - findViewById(R.id.toggleButtonEdit); editToggle.setOnClickListener((view) { setForEditing(editToggle. isChecked()); }); 70 a 72 73 74 75 76 77 78 79 private void setForEditing(boolean enabled) { EditText editName - findViewById(R.id.editName); EditText editAddress - findViewById(R.id.editAddress); EditText editcity - findViewById(R.id.editcity) EditText editState - findViewById(R.id.editstate); EditText editZipCode - findViewById(R.id.editZipcode) Event Log Layout Inse ritTort di RA - 1 D..TH/ DR. THI VA 73 74 75 76 77 78 79 private void setForEditine(boolean enabled) { EditText editName - findViewById(R.id.edit Name); EditText editAddress - findViewById(R.id.editAddress); EditText editCity - findViewById(R.id.editcity) Edit Text editstate findViewById(R.id.editstate); Edit Text editZipCode - findViewById(R.id.editzipcode); Edit Text editPhone - findViewById(R.id.editHome); EditText editcell - findViewById(R.id.editCell); EditText editEmail - findViewById(R.id.editeMail); Button buttonChange - findViewById(R.id.buttonBirthday); Button buttonsave - findViewById(R.id.buttonSave); 80 82 83 84 85 86 87 88 89 90 editName.setEnabled(enabled); editAddress.setEnabled(enabled); editcity.setEnabled(enabled); editState.setEnabled(enabled); editZipCode.setEnabled(enabled); editPhone.setEnabled(enabled); editcell.setEnabled(enabled); editEmail.setEnabled(enabled); buttonChange.setEnabled(enabled); buttonSave.setEnabled(enabled); 91 92 93 94 95 96 97 if (enabled) { editName.requestFocus(); 98 99 a Event Log Layo AD Prnfiler Ruld Loacat 97 98 if (enabled) { editName.requestFocus(); } 99 100 101 102 103 104 105 of 109 private void initChangeDateButton() { Button changeDate findViewById(R.id.buttonBirthday); changeDate.setOnClickListener((view) - { FragmentManager fm - getSupportFragmentManager(); DatePickerDialog datePickerDialog = new DatePickerDialog(); datePickerDialog.show(fm, tag: "DatePick"); 110 111 112 }); 114 115 116 117 118 119 @Override public void didFinishDatePickerDialog(Calendar selectedTime) { TextView birthDay - findViewById(R.id.textBirthday); birthDay.setText(DateFormat.format( informat: "MM/dd/yyyy", selectedTime)); } 120 121 122 } 123 Make the navigation work for all activities in the app. Copy the navigation bar XML code to the layout associated with each activity. Copy the Java code that makes the buttons work to the Java file associated with each activity. You will have to modify that code to reference the activity it is in, rather than MainActivity. Add code to disable the ImageButton associated with the activity that is displayed LTE A My Contact List OFF SAVE Contact Enter Name Address Enter Street Address City Stat Zipcode Home Phone Cell Phone E Mail Address "d Birthday 01/01/1970 CHANGE ODO ESS: k?xml version="1.0" encoding="utf-8"?> droidx.constraint layout.widget.ConstraintLayout xmlns:android-"http://schemas.android.com/apk/res/android" xmlns:app "http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" tools: context-".MainActivity"> 26 NA 27 28 29 30 31 32 33 34 35 cor 36 37 cor 38 39 40 ra 41 42 B 43 44 45 46 lay 92 13 14 15 16 17 48 49 50 51 52 53 54 55 56 57 58 59 87 88 89 90 91 92 93 94 95 96 1 97 98 99 100 101 102 103 104 105 186 EditText android:id="@+id/editName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginstart-"16dp" android:layout_marginLeft="16dp" 107 108 169 X contact activity.contact map.xml select_date.xml x 3 1 anaroza: 1ayout_neignt= wrap_content android:layout_marginstart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="8dp" android:ems="14" android:input type="textPersonName" android:hint-"Enter Name app:layout_constraintStart_toStartOf="parent" app:layout_constraint Top_toBottomOf="@+id/textContact" android:imeOptions="actionNext"/> 2 3 4 5 8 9 2 -3 24 25 26 27 28 29 EditText android:id="@+id/editAddress" android:layout_width="wrap_content" 31 spring 2021 s.xml x activity_main.xml activity_contact_list.xml activity_contact_map.xml select_date.xml acti WICALVACH android:id="@+id/textAddress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp." android:layout_marginTop"16dp" android:text="Address: app:layout_constraintStart_toStartof="parent" app:layout_constraintTop_toBottomOf-"@+id/editName" /> colors.xml x activity_main.xml activity_contact_list.xml activity_contact_map.xml x select_date.xml x 58 59 android: hint-"Enter Street Address" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textAddress" android:imeOptions="actionNext"/> le 11 12 13 14 15 16 37 38 19 Edit Text android:id="@+id/editCity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart-"16dp" android:layout_marginLeft-"16dp" android:layout_marginTop="8dp" android:ems="9" android: hint-"City" .android: imeOptions="actionNext" android:input type="textCapWords" android: nextFocus Down="@id/editState" app:layout_constraintStart_toStartof -"parent" app:layout_constraintTop_toBottomof -"@+id/editAddress" /> 50 51 52 53 54 55 56 57 58 59 EditText android:id="@+id/editstate" android:layout_width="wrap_content" android:layout_height="wrap_content" 60 61 intado psc main res layout activity_main.xml activity_main.xml activity_contact_list.xml app D. Pixel Emulator Spring 2021 activity_contact_map.xml select_date.xml x colors.xml x activity 160 161 162 163 164 165 android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginstart="2dp" android:layout_marginLeft="2dp" android:layout_marginTop="8dp" android:ems"2" android:hint="State android:input type="textCapCharacters" android: maxlength="2" android:nextFocus Down="@id/editZipcode" app:layout_constraintStart_toEndOf="@+id/editCity" app:layout_constraintTop_toBottomOf="@+id/editAddress" /> 166 167 168 169 170 171 172 173 174 175 176 177 178 187 188 189 190 191 192 193 194 195 196 197 198 199 200 281 202 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 Edit Text android:id"@+id/editEmail" android:layout_width="wrap_content" android:layout_height="Wrap_content" android:layout_marginstart="16dp" android:layout_marginleft="16dp" android:layout_marginTop-"8dp" android: ems-"16" android:imeOptions-"actionNext" 249 250 251 297 activity contact map.xml select_date.xml x TE 250 1251 252 android:layout_marginTop="8dp" android:ems="16" android:imeOptions="actionNext" app:layout_constraintTop_toBottomOf="@id/textEmail" app:layout_constraintstart_toStartof="parent" /> 253 254 255 256 257 258 259 260 19261 of 262 263 Of 264 265 266 Ara 267 268 269 270 B 271 272 lay 273 274 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 elayout.widget.ConstraintLayout> o Contact Map Activity java X Pixelmulator Spring 2021 anydpi-v26Vic_launcher_found.xml anydpl-v26Vic launcher.xml ContactListActivity java package com.example.mycontactlist; 2 import androidx appcompat.app.AppCompatActivity import androidx.fragment.app.FragmentManager: MainActivityjov 9 10 import android.content. Intent; import android.os.Bundle; import android, text.format.DateFormat; import android.view.View; import android.widget.Button; Import android.widget.EditText; import android.widget.ImageButtons import android.widget.TextView; import android.widget.ToggleButton; 12 13 14 15 import java.util.Calendars 16 17 18 . public class MainActivity extends AppCompatActivity implements DatePickerDialog SaveDatelistener 19 20 21 of 22 23 24 25 26 @override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Device File Explore initListButton(); initMapButton(); initsettingsButton(); G Emulator 27 HABATAA 1+ CI Contact ustActivity Java x Contact Map Activityjava MainActiv setContentView(R.layout.activity_main); initlistButton(); initMapButton(); initSettingsButton(); initToggleButton(); setForEditing(false); initChangeDateButton(); B 1 } 2 3 14 35 37 38 39 10 A 42 43 private void initListButton() { ImageButton iblist- findViewById(R.id. imageButtonlist); iblist.setOnClickListener((view) Intent intent - new Intent( packageContext: MainActivity.this, ContactListActivity.class); intent.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); 3); } private void initMapButton() { ImageButton ibList - findViewById(R.id. imageButtonMap); iblist.setOnClickListener((view) { Intent intent - new Intent( packageContext: MainActivity, this, contactMapActivity.class); intent. setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); }); } private void initSettingsButton() { Event Log 44 45 47 48 49 50 a 52 53 Lay LITE O snares app 47 48 19 Build Run Tools VCS Window Help MyContactlist - MainActivityjava MyContactList.appl - Android Studio ole mycontactlist MainActivity D. Pixel Emulator Spring 2021 anydpi-v26\ic launcher_found.xml anydpl-v26\ic launcher.xml ContactListActivity.java Contact Map Activity java X MainActivity jave Intent intent- new Intent( packageContext: MainActivity.this, ContactMapActivity.class); intent. setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); 50 }); 52 } private void initSettingsButton() { ImageButton iblist - findViewById(R.id. imageButtonSettings); SS iblist.setOnClickListener((view) { Intent intent = new Intent( packageContext: MainActivity. this, contactSettingsActivity.class); 58 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); 53 54 57 59 60 }); 62 63 64 65 66 O 69 private void initToggleButton() { final ToggleButton editToggle - findViewById(R.id.toggleButtonEdit); editToggle.setOnClickListener((view) { setForEditing(editToggle. isChecked()); }); 70 a 72 73 74 75 76 77 78 79 private void setForEditing(boolean enabled) { EditText editName - findViewById(R.id.editName); EditText editAddress - findViewById(R.id.editAddress); EditText editcity - findViewById(R.id.editcity) EditText editState - findViewById(R.id.editstate); EditText editZipCode - findViewById(R.id.editZipcode) Event Log Layout Inse ritTort di RA - 1 D..TH/ DR. THI VA 73 74 75 76 77 78 79 private void setForEditine(boolean enabled) { EditText editName - findViewById(R.id.edit Name); EditText editAddress - findViewById(R.id.editAddress); EditText editCity - findViewById(R.id.editcity) Edit Text editstate findViewById(R.id.editstate); Edit Text editZipCode - findViewById(R.id.editzipcode); Edit Text editPhone - findViewById(R.id.editHome); EditText editcell - findViewById(R.id.editCell); EditText editEmail - findViewById(R.id.editeMail); Button buttonChange - findViewById(R.id.buttonBirthday); Button buttonsave - findViewById(R.id.buttonSave); 80 82 83 84 85 86 87 88 89 90 editName.setEnabled(enabled); editAddress.setEnabled(enabled); editcity.setEnabled(enabled); editState.setEnabled(enabled); editZipCode.setEnabled(enabled); editPhone.setEnabled(enabled); editcell.setEnabled(enabled); editEmail.setEnabled(enabled); buttonChange.setEnabled(enabled); buttonSave.setEnabled(enabled); 91 92 93 94 95 96 97 if (enabled) { editName.requestFocus(); 98 99 a Event Log Layo AD Prnfiler Ruld Loacat 97 98 if (enabled) { editName.requestFocus(); } 99 100 101 102 103 104 105 of 109 private void initChangeDateButton() { Button changeDate findViewById(R.id.buttonBirthday); changeDate.setOnClickListener((view) - { FragmentManager fm - getSupportFragmentManager(); DatePickerDialog datePickerDialog = new DatePickerDialog(); datePickerDialog.show(fm, tag: "DatePick"); 110 111 112 }); 114 115 116 117 118 119 @Override public void didFinishDatePickerDialog(Calendar selectedTime) { TextView birthDay - findViewById(R.id.textBirthday); birthDay.setText(DateFormat.format( informat: "MM/dd/yyyy", selectedTime)); } 120 121 122 } 123

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

Students also viewed these Databases questions