MAP524/DPS924 Lab 2

From CDOT Wiki
Revision as of 17:27, 3 July 2015 by Andrew (talk | contribs) (Part C: Answer the following questions in your labbook)
Jump to: navigation, search

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:
    1. Change the background colour to something nice.
    2. Add a new string to the strings.xml file. Call the new string "hello_me" and set its value to "Hello <your name>!".
    3. 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.

Part B: Move your app to GitHub

  • If you do not have a github account please make one now.
  • In the VCS menu of Android Studio select "Enable Version Control Integration". Then in the drop-down menu select "git".
  • Next in the same VCS menu select "Import Into Version Control" followed by "Share Project on Github".
  • Your github project cannot have spaces in its name so change the name from "MAP524 Lab 2" to "MAP524_Lab_2".
  • You may be asked for a master password so just make one up and enter it.
  • Your project is now created on github but it is empty so we need to do a commit and a push.
  • Again in the VCS menu select commit.
  • Enter your commit comment and then push your changes onto github.
  • To verify you successfully pushed your project onto github, just open a browser and go to github to see your files.
  • Once your project is correctly placed onto github, please move onto part C.

Part C: Answer the following questions in your labbook

  • What is the URL of your github account?
  • Explain in your own words what is meant by each of these Android Studio terms or phrases:
    1. project
    2. panel
    3. toolbar
    4. status bar
    5. preview pane
    6. android pane
    7. project explorer
    8. .idea folder
    9. intellisense
    10. module
    11. live layout
  • Explain each GIT term in your own words using one or two short sentences (on Linux use the command "man git" for help, but better yet find a simple Git tutorial online):
    1. init
    2. commit
    3. push
    4. add
    5. pull
    6. branch
    7. clone
  • Show your work to the professor in the lab and get him to sign off on your labbook.