CISC181 S2015 Lab10
- Make a new Android project with n = 10 following these instructions through step 6. On step 7 "Select form factor...", switch over to step 3 on the Android developers page tutorial here and complete through step 8 "Click the Finish button to create the project." Make the activity be called "MyActivity".
Make the blank activity project as described above and confirm that you can build and run it in person for the TA or professor. You may demonstrate this either on the emulator or an actual Android device connected to the machine running Android Studio. You can do this during lab Monday or in office hours during the week.
Take the blank activity project and modify it to become a very simple "rock paper scissors" generator as detailed below:
- Change the layout in activity_my.xml to a vertical LinearLayout, similar to this example
- Change the old TextView that was printing "Hello, world" to say "Click the button below to get a new shape".
- Add an ImageView underneath, centered laterally, that initially shows a rock, paper, OR scissors image. Find your own for these, cropped and scaled to 250 x 250, and put them in res/drawable with the names "rock.png", "paper.png", and "scissors.png". Here's some help for drawable resources
- Add a TextView underneath the image which acts as a caption, saying "Rock" if the image is a rock, "Paper" if it's paper, and "Scissors" if it's scissors. The caption should be centered laterally.
- Finally, add a centered Button under the caption. This button should be labeled "New" and when pressed causes another random selection which (possibly) changes the image and caption above . The text should be set not through resources but instead by using setText() in MyActivity.java (see last slide from Apr. 27 lecture), and something similar should be done with the image.
Note: Do NOT make changes to any other XML resource file besides activity_my.xml. Also, you may use your modified project from part 2 to satisfy part 1 -- that is, you can demonstrate compiling and running in person with the part 2 code/resources.
Here is a screenshot of a sample program that satisfies the above requirements:
Submit your MyActivity.java and activity_my.xml. Make sure your name is in both. FYI, comments in XML files look like this:
<!-- here is my name -->