Question: Assignment Tasks: 1 . Create a new branch in Git. Start by selecting the Git menu in Android Studio and select Branches . In the
Assignment Tasks:
Create a new branch in Git. Start by selecting the Git menu in Android Studio and select Branches In the resulting dialog click New branch and call it lab
Delete the existing activities and layouts from your lab branch to start fresh.
Create a new empty activity named MainActivity by going to File New Activity Empty Views Activity and update the layout to look like the following:
It has three elements, a TextView that says Enter your name with an empty EditText below it and a Next button.
Create another new empty activity, but this time name it NameActivity and update the layout to look like the following:
This also has three elements, a TextView that simply says Welcome and two buttons on the next row that say, Thank You and Dont call me that
Next, well finish implementing the MainActivity. It should have the following features:
a When the Next button is clicked, get the current value of the EditText, put it into an Intent and launch the NameActivity. We will be passing data back so use startActivityForResult not startActivity
b Click on the MainActivity class name, press Control O and select onPause from the list to add an override. Save the value current value inside the EditText to the SharedPreferences so it can be loaded next time the user opens the app.
c Inside the onCreate load the users name from the SharedPreferences and put it in the EditText. If the users name isnt yet saved in the SharedPreferences, do not put anything in the EditText.
Implement the NameActivity next, it should do the following:
a In onCreate get the users name passed from the previous activity and update the TextView to welcome the user. For example, if the user entered the name Jason in the EditText in MainActivity and pressed Next the NameActivity should show Welcome Jason!
b If the user presses Dont call me that set the result to and return to the previous activity.
c If the user presses Thank you set the result to and return to the previous activity.
Back in MainActivity implement the handling of the result code from the NameActivity.
a If the result code is the user wants to change their name.
b If the result code is the user is happy, so we can use finish to close the app.
Ensure that all the labels and buttons in your app use the strings.xml files and are localized properly in both English and French. Use Google Translate to get the French translations of your English buttons if needed.
Finally, include a screenshot with your Brightspace submission demonstrating to your facilitator how to access the SharedPreferences file on your emulator via ADB.
Use the Android Studio terminal window to log into the phone using adb shell From the command line, type runas packagename Then navigate to datadatapackagenamesharedprefs and display the shared preferences using more filename.xml
Report format: Please take snapshots of your emulator output with different outputsuse casesapp running with different windows add a brief explanation of your code and snapshots in a word doc. Submit the word doc on brightspace in the lab folder.
Include a link to your GitHub repository as comment on Brightspace when submitting the assignment on BrightSpace.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
