Lab 2
This assignment relates to the following Course Learning Requirements:
• CLR 1: Write a graphical user interface-based program, given design documents. Techniques used will be object-oriented programming, structured programming, top-down coding, and event-driven coding.
• CLR 2: Produce tested code that executes correctly and consistently. Testing procedure will involve the use of iterative testing of GUI program components, valid data only, invalid data only, a combination of valid and invalid data and set wise refinement involving users.
• CLR 3: Prepare program documentation using prescribed program specifications.
• CLR 4: Debug program problems using manual and programmatic methods.
• CLR 5: Modify an existing program according to program specifications.
• CLR 6: Access and modify a database table from within the graphical user interface. Create a layered application (Presentation, Business, and Data access layers). Use a Data Access layer to provide data access to an application.
• CLR 7: Create GUI programs that support internationalization as well as sustainability.
• CLR 8: Collaborate with fellow students in a team to complete complex assignments.
Objective of this Assignment:
The following is an exercise to help you implement what you have learned in this module. It will allow you to familiarize yourself with the module content as well as practice the skills required to develop software in the Android Studio. The goal of this lab is become familiar with how XML and Java are combined for creating user interfaces. The layouts and widgets are created in XML, and Java then gets references to the objects created in XML to control the behavior of the application.
Pre-Assignment Instructions:
1. To prepare you for this assignment, please read the content presented in the associated module.
2. References:
a. https://developer.android.com/guide/topics/ui/controls/button
b. https://www.tutorialspoint.com/android/android_user_interface_controls.htm
c. https://stuff.mit.edu/afs/sipb/project/android/docs/guide/topics/ui/controls.html
Assignment Tasks/Steps:
1. Create a branch of your software from Lab 1. Select the VCS menu in Android Studio and click “Git” -> “branches”. From the dialog box, select “New Branch” and call it “Lab_2”. Using a new branch means that all your software commits will only change this branch, and not the original branch. This means you can go back to the “master” branch at any time.
2. Go to http://flaglane.com/ and look for an image of a Canadian flag. You should download the small PNG file, 200 pixels wide. Once downloaded, rename the file flag.png. Copy the file into the drawable folder in AndroidStudio. Next right-click on the “res” folder and select “New” -> “Android Resource Directory”. Set the resource type to be drawable, and set the directory name to be “drawable-XX”, but replace the XX with the two letter language code that you used for your strings file, for example “drawable-es” for Spanish. Next, download a flag of that country from http://flaglane.com/, a PNG file 200 pixels wide. Rename that file flag.png and copy it into the new drawable-XX folder you created. You will use these flags for the ImageButton later.
3. The rest of this lab is to create three different layouts that all look like the image on the next page. You’ll need to create these files in the IDE (copy if you wish, but you’ll need to change them).
a) One should use only LinearLayout. Call it activity_main_linear.xml.
b) One should use a GridLayout. Call this activity_main_grid.xml.
c) One should use a RelativeLayout. Call this activity_main_relative.xml
Students succeed in their courses by connecting and communicating with an expert until they receive help on their questions
Consult our trusted tutors.