MAP524/DPS924 Lab 2
Lab2: First App with Android Studio
For this and all following labs you will need your USB memory stick from lab 01 or use your own Linux/Windows/Mac system.
Part A: Creating your First Android Studio Project
- Start Android studio.
- Select "New Project" from the "Quick Start" menu.
- For the App name enter "MAP524 Lab 2" or "DPS924 Lab 2".
- You can now create a default Android Studio app with just a few clicks of the mouse. All the code will be automatically generated. Click Next.
- On the next screen you can set the Minimum SDK to API 15 for Phone and Tablet. Do not set up anything for TV, Wear or Glass. That will come later. Click Next twice then click Finish.
- Your app should now be successfully built by Gradle.
- Now you can create an AVD using the AVD Manager. Create an AVD for the Nexus4 phone. The target and Platform should be Android 4.4.2, API level 19. The CPU/ABi should be x86. Set your AVD scaling to "2 pixels on device = 1 pixel on screen" - this will make your AVD half size.
- You can now start your AVD.
- Take a screenshot of the AVD by first bringing up the Android DDMS window pane and then clicking on the camera icon. Note: if the image is all black then edit your AVD and disable GPU acceleration and take a second screenshot. This time it should work.
- Finally, install and run your app by clicking the "Run" icon on the top tool bar. NOTE: The first time you run you'll notice that Gradle and a few other components of Android Studio may be updated by automatic downloads of newer versions.
- When your app runs correctly make the following modifications to it:
- Change the background colour to something nice.
- Add a new string to the strings.xml file. Call the new string "hello_me" and set its value to "Hello <your name>!".
- Set the TextView on the screen to now display this new string instead of the old one.
- When your app is running take a screen shot (png file) of the AVD and save it as res/raw/lab2.png. Note: you'll have to create a new directory named "raw" inside the "res" folder.
When satisfied with using Android Studio to build a default app, please move on to PART B of this lab.