Devchix Task List Android App

Posted by Jessica Fri, 25 Sep 2009 03:01:00 GMT

This post is to basically explain how the Devchix to do list android app that Nola and I have been working on works. Currently, we are working on Iteration 1 of our plan. Here’s how I understand what we have working so far: In our app, users can switch between 2 activities using the menu option, “Add Task”.

When our app is first opened the first activity that is rendered is the ViewTasks activity. We first start with some setup steps…. we inflate our layout, create our task database and open a connection to that database. We create a cursor that will just represent all tasks that we have put in our database and we call the startManagingCursor method, so that we do not have to do that ourselves.

We get a ListView from our ListActivity; this ListView will be our list of tasks. In our ViewTask activity, we have a subclass class called TaskAdapter, that will help us get data out of our cursor and into our list view. Lastly, we set our TaskAdapter as an adapter on the ListView we just created.

When the user clicks on the menu button, we will see the two menu options whose names we grabbed out of our strings.xml. And because we have implemented the onMenuItemSelected to detect which option the user selects, we the user selects the Add Task option, our second activity will be started where users can enter the name of the task and save the task to the tasks database.

If there are already Tasks in the task database, then TaskAdapter will inflate a new row from the records we get back from our query and then have the TaskWrapper place the contents of the cursor into a Task object. The task object represents has getters and setters for setting the various task fields, which may be overkill right now because we don’t have many fields but as our application grows and expands to do more complex things with task information this may make our code more modular.

Other than creating the table, I don’t believe the methods we have in the TasksDbAdapter class are currently being used. Depending on how we want to clean the code up, we may be able to refactor this class—either move the db creation into the ViewTask activity or move the other queries out into the TasksDbAdapter.

Here’s the link to the Devchix Task List Android App on Google Code.


designed by jowensbysandifer