Algorithms and OOD (CSC 207 2013F) : Labs
In this laboratory you will learn how to create Android applications, as well as Android Application Projects in Eclipse. You'll learn what the basic components of an app are, how to modify them, and finally how to run your application.
Make sure you've completed and understood the reading, Introduction To Android.
a) In Eclipse, create a new Android Application Project
b) Give it an application name, like First Project, and a project name
c) Name the package "edu.grinnell.CSC207.F2013.your_username.project_name"
d) Give your activity a descriptive name, and finish creating the project
a) Add another TextView to the layout xml for your only activity. Save the file and look at the Graphical Layout file. Did anything change?
b) Why is the TextView you've just created positioned on top of the auto-generated one?
c) Can you figure out how to move it (either programatically or visually)?
d) Depending on if you changed your TextView's position via the raw xml or the Graphical Layout, explain what happens in its counterpart?
e) What are some other attributes you can use for a TextView? * Hint: You can see those, by typing "android:" on another line inside the TextView and waiting for Eclipse to give you an options menu of how to continue.
f) In the Graphical Layout drag out some objects from the Palette on your app's screen and see how they're programatically added in the xml file.
g) Go into the raw xml file and replicate some of the objects with a different value for the attributes.
h) The project creates a relative layout for you to place your objects on by default. What are some other layouts you can use, and what are their strengths and weaknesses? * Hint: You might want to do a google search for this one
a) Add a new String via the Resources tab in the strings.xml file
b) Does the main activity xml file in the layout folder change? Why or why not?
c) In the raw xml tab in the layout's main activity xml file, change the android:text attribute by replacing hello_world with your new string's name.
d) Save the file. How does this affect the graphical layout.
e) Add more TextViews or other textual objects to your layout and assign them different strings.
f) Repeat a-e, this time adding strings via the raw xml in the strings.xml file
a) Use the AVD Manager to create an emulator
b) Compile and run your app on the emulator you just created
c) Was the run successful? Why or why not?
d) If the run was successful, plug in your Android device and run the app on the device.
e) In your opinion, is it better to use the emulator or the actual device and why?
a) Go into the AndroidManifest.xml file and change the target version from 17 to 12.
b) Save, compile and run your app.
c) Does it run fine? Why or why not?
d) How would you change the name of your app that appears on the top black bar?
e) Looking at the names of the attributes for objects in the manifest file, can you tell what they do? Remove some attributes, or change them and see what happens when you try to compile.
f) Change the manifest file back to its original state, to make sure the app compiled correctly.
g) Add a new item to the main menu xml. What happens when you compile and run the app?
Copyright (c) 2013 Samuel A. Rebelsky.
This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.