CS4518 Project 1: Getting Started with Android Programming solution




5/5 - (5 votes)

1 Project Overview
In this project, you will be writing your first Android app1
4 by modifying an existing basketball score app. I will
5 provide you with the starter code (see Section 2.3) and requirements (see Section 3) about new features that you
6 should implement. The goal of this project is to get you started with using Android Studio, designing Android UIs,
7 managing app resources, understanding app life cycles, and intents.
8 A few important things to know before starting this project.
9 • If you have any questions regarding this project, please post it in the forum with the part you have questions
10 with (using line numbers to the left).
11 • Inside the same zip file, there should be two pdf files and one code zip file.
12 • This project is due by 10:00pm on Oct 31 and accounts for 10% of total points. Please do start early on
13 this project. You should be able to follow the instructions to setup Android Studio and complete tasks until
14 Section 3.4 after our first class.
15 • Each student must complete this project individually. However, I do encourage you to share ideas, advice
16 and resources with each other. Please contact me if you have questions about what constitutes appropriate
17 collaboration.
18 • Project instructions are provided based on Android Studio. You may, however, choose to use any other IDEs
19 of your choices. But keep in mind that teaching staffs will less likely be able to provide helps if needed.
20 2 Project Preparations
21 Before you can start modifying the code using Android Studio, you need to prepare yourself by following the steps
22 below.
23 2.1 Prepare Android Studio
Android Studio is the official IDE for developing Android apps. It is based on IntelliJ IDEA from jetbrains2
24 That
25 means, if you use any jetbrains IDEs, Android Studio should feel like familiar to you.
26 • Install Android Studio on your computer. I strongly encourage everyone to setup Android development en27 vironment on your personal machine. Please follow the guide on [office Android Site] about how to install
28 Android Studio on different OSes. Alternatively, you can also find YouTube tutorials, for example, [thenew29 boston], for installation instructions. However, Android EcoSystem is going through very rapid changes and
30 those unofficial online resources are very likely outdated, and thus might not work straightforwardly. Please
31 only use those online resources as references and at your own cautious.
32 Optionally, you could also use Android Studio 2.1 that is already installed on ZooLab machines. If you don’t
33 have card access to ZooLab yet, please let me know so I can request it for you.
34 • Configure Android Studio. There is really no much you need to configure. I often take the “lazy” approach
35 and only configure when needed. But if you insist, go check out a number of things you can configure [here].
36 and install some recommended packages through SDK Tools guide [here].
37 • Explore Android Studio. If you want to get comfortable with Android Studio, you can read about [project
38 structure] and its [user interface].
If you have any prior experiences with Android programming or mobile development, you should use it as an opportunity to warm up
for the term.
I switched from plugins based Vim environment to jetbrains a few years ago. And I love it. Jetbrains provides professional IDEs for
educational licenses. If you write a lot of python codes like I do, you should check out Pycharm Professional.
Tian Guo, WPI Page 1 of 4
39 2.2 Prepare your Android Devices
40 You have two options when it comes to testing your Android apps, running on an Android Virtual Device (AVD)
41 or on a physical Android device.
42 • To create an AVD, please follow the steps from Android Developer Site [here]. I strongly suggest you create
an AVD by first duplicating and then modifying the cloned AVD.3
44 • To use your own Android device, you will have to at least enable USB debugging from the Developer
45 Options. For Android 4.2 and higher, please follow the instructions at [how to enable on-device developer
46 options]. For Android that runs older versions, you can go to Settings > Developer options and check the
47 box for USB debugging.
48 • Create an Emulator, or enable USB develop on your phone.
49 Android Studio comes with Android Emulator that allows you to simulate Android Virtual Device (AVD) in
50 your own computer. In a high level, you can equate an AVD to a physical Android device. This is very helpful
51 because you can start developing and testing Android apps without a hardware device. Android Emulator
52 is great as it supports a lot of physical device features, and allows you to test against a wide selection of
53 virtual devices. However, Android Emulator can be slow sometimes. Be patient! Even with a very powerful
Macbook Pro, I still experience significant slow down when testing apps using Android Emulator. 4
55 2.3 Prepare Starter Code
56 • To quickly test if your Android development environment is setup properly, please follow the steps [here] by
57 first creating the Hello World Project, and then running the app in the Android Emulator [here]. You will
58 not see any error messages if the setup is proper.
59 • Starter code is downloaded as a zip together with this project 1 description. Import the starter code into
60 Android Studio and Make sure the starter code can compile and run on your Android device or AVD. I have
61 tested the code in a Galaxy Nexus running Android 4.3 (API level 18) and an AVD running Android 5.0 (API
62 level 21). If you have encountered any problems at this step, please try to resolve them by first checking your
63 Android Studio Setup in Section 2.1, and then following the error messages on Android Studio. If you can
64 successfully run a new project with empty activity, then your Android development is correctly setup. Most
65 of the time, the errors come from missing packages that you just need to click to install.
66 3 Project Requirements
67 After you successfully run the starter code, you are then asked to make the following modifications to earn cor68 responding points. Evaluation of your work will be based on a combination of the implemented features, code
69 quality, and compliance with submission guidelines. For each required modification, please take the resulting
70 screenshots and follow the naming conventions: starting with corresponding section number, e.g. the screenshot
71 from Section 3.1 is saved as 31newicon.png. This helps teaching stuff to provide rapid feedback.
72 3.1 (10 points) Change Application Icon
73 The starter code uses the default android icon. Choose any photos you want, and configure it to be the app icon.
74 Take a screenshot of the app with the new icon, and save the screenshot using 31newicon.png. An example
75 screenshot is shown in Figure 1(a).
76 3.2 (10 points) Greetings with Toast Message
77 Modify the code so that a Toast message will be displayed after the application is first launched. Save the screenshot
78 containing your customized Toast message as 32toast.png. An example screenshot is shown in Figure 1(b).
Just a precaution in case something funny happens.
I usually test apps directly on my Android phone and thus have not looked into ways to fine tune the Emulator to improve performance.
If you find a way to do so, please feel free to share with us by posting in the forum.
Tian Guo, WPI Page 2 of 4
3.1 New Icon
(a) The app with a new icon.
3.2 Toast
3.3 Editable Team names
(b) Toast and editable team names.
Figure 1: Screenshots for Section 3.1, Section 3.2 and Section 3.3.
79 3.3 (10 points) Allow Manually Input Team Names
80 Modify the code so that the hard coded Team Names can be changed. That is, users can input any two team
81 names when using the app. Save the screenshot containing two team names of your choice as 33names.png. An
82 example screenshot is shown in Figure 1(b).
83 3.4 (10 points) Team Profile Photos
84 Modify the app layout so that team profile photos are displayed next to the team names. For this step, you need to
85 choose two pictures you want to use and save them as drawable resources. Save the corresponding screenshots as
86 An example screenshot is shown in Figure 2(a).
87 3.5 (10 points) Supporting Localization
88 And a second string.xml of a language of your choice. In your phone or emulator, change the language from default
89 English to the second language of your choice. Relaunch your app, and take the screenshot of localization effects.
90 Save the screenshot as 35local.png.
91 3.6 (25 points) Correct Scores
92 At this point of time, you might notice that when you rotate your Android device (or AVD), the scores will be reset
93 to 0. Recall why such reset is happening, and modify the code so that, scores will remain unchanged after device
94 rotations. The teaching staff will test this feature by first incrementing scores for both teams, and comparing the
95 scores after rotating the device. Screenshot is not required.
5A quick way to convert pictures to predefined sizes is similar to what you did for Section 3.1.
Tian Guo, WPI Page 3 of 4
3.4 Team profiles
3.5 Localization
(a) Team profile photos and localization support.
user’s email address
3.7 automatic
filling score
(b) Sending scores using an Mail client.
Figure 2: Screenshots for Section 3.4, Section 3.5, and Section 3.7.
96 3.7 (25 points) Sending Scores
97 Add a button Send at the bottom next to Reset, so that user can send the final results through an existing Mail
98 client automatically. The message body should contain at least three lines that reads like the following. Save the
99 screenshot as 37send.png.
100 Wining Team: team dog
101 Team A: team dog has: 6
102 Team B: team cat has: 3
103 Specifically, the first line summarizes the winning team of the game and the following two lines reports their
104 scores respectively. An example screenshot is shown in Figure 2(b).
105 3.8 (20 points) Bonus Features
106 Each extra feature is given a 10 bonus points. For each extra feature you implemented, please briefly describe
107 what the feature is, how you implement it, as well as the screenshots if applicable. Example screenshot names:
108 38bonus1.png etc.
109 4 Project Submission
110 • Before submitting, please take the time to make sure you have a clean build by following this short guide
111 about clean your project build.
112 • Please include a README file If you complete the bonus features in Section 3.8.
113 • Then put all the screenshot photos into a folder called screenshots. Then put both the screenshots
114 and the modified Android project into a new folder named cs4518Project1. Create a zip file from the
115 new folder and submit cs4518Project1.zip through Instruct Assist.
Tian Guo, WPI Page 4 of 4