Individual Programming Assignment 1
Due: by 11:59pm on Jan 31 (now past due)
20 points - Programming
- 1 Overview
- 2 Instructions
- 3 Grading Criteria
- 4 Solution Example
- 5 QuickStart Guide
- 6 Submission Instructions
- 7 Links to Finished Assignments
In your first assignment you will learn how to:
- Install the Android SDK and developer tools
- Start programming with the Android SDK
- Build a simple Android application and test it in the emulator
You will build a currency converter.
Imagine you are having a heated discussion about investing with your friends. They've heard about cryptocurrencies like bitcoin and dogecoin, but haven't looked into it any further. Luckily, you have your trusty currency converter app that you built in CS160. You can enter a total amount in either bitcoin, USD, or dogecoin and it will be converted automatically for you, based on the current exchange rate.
You will submit your source code, the executable, screenshots and a narrated video. It is your responsibility to ensure that the executable has all the resources it needs to execute.
- Choose a development machine: You should be able to do development on your own laptop and we expect that most people will want to do this. Android has good support for Windows, Mac and Linux. You can also use EECS instructional machines in 277 Soda if you want to. Please send us a message on Piazza right away if you want to go that route so we can get some machines set up.
- Install the Android SDK and development tools: Instructions for setting up the tools and environment are in Section 1. We have had success with WinXP(32 bit), Vista(32 bit) and Windows 7(64 bit), an OS X Mac and Linux. The section on Thursday, January 23 will cover how to do this, on your own machine and the lab computers. We recommend using Eclipse as your IDE. You can also build Android applications through the command line, but we will not be able to help you with this process.
- Application Functionality: Your application must
- be able to enter a currency amount, in either bitcoin, US dollars, or dogecoin
- convert currency between the rates at the current exchange rate (the exchange rate may be hard-coded)
- be able to select which two currencies to convert between
One possible way of achieving these goals is to break your application down in the following fashion:
The main view should be the currency converter.
- Provide a text field for entering a base value and a radio button to select a base currency
- Provide a text field for showing the converted value and a radio button to select a converted currency
- Provide a button to update the converted value
This is by no means a brilliant design for a currency converter. You are free to design your own app provided that it has the functionality as enumerated above.
Full credit (20 points) will be given if your application compiles, runs, contains the functionality as detailed in the instructions, and your documentation (writeup, photos, video) is complete.
Up to 5 extra points will be given if you implement additions that make the application more usable or more aesthetically pleasing. For example, you can implement the following:
- Enable conversions between other pairs of currencies
- Update the exchange rate using a web service and automatically refresh the exchange rate periodically as the app runs (see AsyncTask and HttpURLConnection)
- Display a sparkline of recent exchange rates
- Enable orientation (app should be viewable in portrait and landscape mode)
Creating a new Project
In Eclipse, Create a new project with File→New→Project. From within the new project dialog, select Android→Android Application Project.
Give the project a name, e.g. "CurrencyConverter". Check the most recent Android SDK version. Scroll down to find the properties for this project. Some suitable options here are:
- Application Name: Currency Converter
- Package Name: edu.berkeley.cs160.yourname.prog1
- Create Activity: CurrencyConverter
- Minimum SDK version: 13
The SDK version is the alternative numbering for the 3.2 Honeycomb API. Click "Next" or "Finish" and you should find your project created in the Package Explorer. Explore the project. Under res→layout you will see the layout xml file as main.xml. This file defines the widgets in the UI. You typically edit this file first to create the widgets you need, and then add code to interact with them in the src directory. Navigate up to the src directory which will contain a file CurrencyConverter.java under the package node. Look inside. It will contain the definition of the new CurrencyConverter class with a single "onCreate" method which loads the layout file.
Building and Running
Try building the project with Project→Build Project. Assuming that worked, you can run the project in the emulator. Follow the directions in the course "Tips and Tricks" page. You should see a screen that says "Hello World, CurrencyConverter!". You are off and running. From here you can iterate on your design, gradually adding functionality.
You can use LinearLayout, AbsoluteLayout, or RelativeLayout containers. Droiddraw is a third-part utility that can help you generate layout files. If you use Droiddraw, it will give you an absolutelayout with pixel coordinates for all the widgets. RelativeLayout is the most general, but may be a little more work to get want you want. If you use LinearLayout, you may want to insert some empty FrameLayout objects between your widgets to add extra space. Setting the FrameLayouts height to zero, and using the layout_weight property instead produces the effect of elastic spacing between the widgets.
Some interesting links on layouts, and the options you have with them are:
You can breeze through the assignment even with Linear Layouts, but we would recommend experimentation with various different layout schemes once you are done with the basic code. The earlier you do this in the semester, the closer you inch to success in the final project.
You will want several kinds of listeners on your widgets. OnClickListener's are the right option for buttons and the OnEditorActionListener will allow you to respond to "enter" events on editable text boxes.
Create a Wiki Page for this assignment
Begin by creating a new wiki page for this assignment. Go to your user page. Edit your user page to add a link to a new wiki page for this assignment. The wiki syntax should look like this:
[[ProgrammingAssignment1-FirstName_LastName|Programming Assignment 1]]
Again replace FirstName and LastName with your name. Look at my user page for an example. Then click on the link and enter the information about your assignment.
Writeup and Photos / Videos
Describe (briefly) what design decisions you made and why you made them. Include screenshots of key screens.
Then record a short (<60 second) video of you using your application. Narrate and explain what you are doing. No video editing is necessary - you can send us a single take. To record your screen, try screencast-o-matic.com, or Quicktime Screen Recording on a Mac. You can either upload an MP4 file (<100Mb) or upload your video to YouTube and link to it.
To embed a video use the
<mediaplayer> tag (documentation).
The two most common ways are to either upload an mp4 file like this:
<mediaplayer>File:CurrencyConverter.mp4</mediaplayer, or embed a YouTube video like this:
You should then upload your source as one file (described below) and in the wiki page, describe any extra credit functionality you implemented and want us to review.
- Your submitted project must include both the full source code as well as the executable of the working application.
- Create a zip file of your project tree (the top-level folder that includes the Eclipse project. Rename the zip file to ipa1.zip
- Upload the zip file to an EECS instructional machine
scp ipa1.zip firstname.lastname@example.org:
- Once you've uploaded the file, ssh into the machine and submit your assignment:
Add Link to Your Finished Assignment
One you are finished editing the page, add a link to it at the bottom of the page with your full name as the link text. The wiki syntax will look like this: *[[ProgrammingAssignment1-FirstName_LastName|FirstName LastName]]. Hit the edit button for the last section to see how I created the link for my name.
Links to Finished Assignments
Add your submission below this line:
- Bjoern Hartmann
- Andrew Fang
- Daniel Koohmarey
- Tristan Jones
- Ian Birnam
- Maya Rosecrance
- Vinit Nayak
- Ryan Yu
- Allison Leong
- Emon Motamedi
- Charles Park
- Doug Cook
- Christopher Echanique
- Christina Guo
- Ziran Shang
- Myra Haqqi
- Emily Reinhold
- Emily Sheng
- Haley Rowland
- Jimmy Bao
- Steven Pham
- Sijia Li
- Eric Hong
- Andrew Lee
- Hao-Wei Lin
- Aayush Dawra
- Sol Park
- Steven Wu
- Tien Chang
- Sang Ho Lee
- Robin Sylvan
- Daniel Haas
- Andrew Dorsett
- Cory McDowell
- Nicholas Dueber
- Andrew Chen
- Alexander Chen
- Albert Luo
- Shana Hu
- Shaina Krevat
- Jeffrey DeFond
- Zack Mayeda
- Matthew Deng
- Erik Bartlett
- Greg Quan
- Kaleong Kong
- Jay Kong
- Seth Anderson
- Brenton Dano
- JuanPablo Hurtado
- Namkyu Chang
- Stephanie Ku
- Dalton Stout
- Daphne Hsu
- Justin Chan
- Diana Lu
- Bryan Sieber
- Max Dougherty
- Insuk Lee
- Prashan Dharmasena
- Conan Cai
- Seyedshahin Ashrafzadeh
- Gavin Chu
- Sol Han
- Justin MacMillin
- Andrea Campos
- Michelle Nguyen
- Nahush Bhanage
- Anthony Sutardja
- Patrick Lin
- Lauren Speers
- Peter Wysinski
- Christopher Schechter
- Meghana Seshadri
- Liliana (Yuki) Chavez
- Luke Song
- Anju Thomas
- Will Tang
- Brian Yin
- Derrick Mar
- Jeffrey Butterfield
- Munim Ali
- Kevin Johnson
- Lisa Li
- Sangeetha Alagappan
- Romi Phadte
- Ravi Punj
- Everardo Barriga
- Chirag Mahapatra
- Zhiyuan Xu
- Aman Sufi
- Cheng Sima