In this week’s session, he created a sample task manager app which can be used for maintaining list of things to track. This app was created using Android 1.6 with Google API support. You can download the source code of this demo app below.
The sample app will have two activities. One will have a simple data entry form which can be used to add tasks and the other to view tasks which were entered. Check the screenshots below to see how the sample app looks like.
Tony (the instructor) briefly explained about the different types of layouts and for the sample apps he used Relative Layout. You can read more about the relative layout from the android documentation.
The major pain point in using Relative layout is that, the controls should be specified in the order in which they are referenced and not in the order in which they will be displayed.
EditText control is an editable control which can be used to get user input. It is similar to the HTML textbox or the Java Swing JTextField.
You can read more about EditText control from android documentation.
Sharing data between views
An application can have multiple activities (views) and to share data between these multiple activities, the android framework provides a class called Application. This Application class can be accessed from all the activities of the app by calling the
getApplication() of the Activity class. Tony explained this about this class and also used it in the demo app to store and retrieve tasks from multiple activities.
You can find this class in the
TaskManagerApplication.java in the sample app. You can download the source code of this demo app below.
You can check the
cancel() method in
AddTaskActivity class, where we will be showing an alert box (see screenshot) using the built in
AlertDialog, whenever the user clicks the cancel button without saving the task that he has entered.
You can read about the AlertDialog class in the android documentation.
I have uploaded source code for yesterday’s session in github and you can download it from there. I am also working in this week’s homework and will be posting the explanation and source code once I am done.
- Recovering Android KeyStore password
- Changing the playback speed of Youtube videos
- Using WebSockets with Android to control Arduino robots
- 10 more open source Android apps which every developer must look into
- Building Robots using Android and Arduino in Google Devfestx
- Transferring data from Android using Audio