Due: Thursday January 17. Firm deadline. You will need to submit an .apk and a .zip source ball; detailed instructions for submission will be posted shortly. For this, you will need to have Eclipse, the Android SDK, etc etc, all running, so I highly advise you to get your environment setup as soon as possible. Don't wait until next week!
You must develop a sheep-counting application, for all the smartphone-wielding shepherds out there.
The application must have three buttons:
The application must also have a counter readout.
The buttons control the readout, quite obviously.
The basic task is to create the app. But, don't stop there: for extra credit, make it nice. Make the buttons nice and big, experiment with their color. Make the readout big and easy to read. Use a sheep photo (with a license allowing reuse) as icon or draw your own.
For the counter, you can use a private int variable in the Application class. This is not ideal, since if the application is destroyed by Android (e.g., because inactive for a while), the counter value is lost. I will teach you later in another class how to make the value persistent, but if you are curious, in this case I would use preferences, as in:
Put this in the Activity class declaration:
private static final String PREFS_NAME = "BasicPreferences";
private static final String SHEEP_COUNT_PREFERENCE_NAME = "sheepCount";
Put this somewhere in onStart:
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
sheepCount = settings.getInteger(SHEEP_COUNT_PREFERENCE_NAME, 0);
Put this somewhere in onStop:
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putInteger(SHEEP_COUNT_PREFERENCE_NAME, sheepCount);
editor.commit();
Again, you don't have to do this. I am just telling you in case you are curious.