This app is basic TodoList app that build for Android. Problem Statement
With a lot of routine and daily work and task, it is hard for the user to keep track their task and might miss out some important task.
Objective Provide a platform that are mobile and portable for user to track their task effectively
How it works
This application is build using Android studio 2.2.1, which the minimum target of the operating system is Android Jelly Bean 4.3.3.
I create 2 package under com.faiz.sodingtaskmanagement:
- DB
- Model
Under the DB package, I create two classes. First one, is TaskDBHandler classes which handle the task for creation database using SQLITE.
The database that I used for this application is tasks.db, I create Tasks table which contain below field:
- Id – autoincrement id to make sure every task created is unique
- Name – used to store the task name
- Description – used to store the description of the task
- dateCreated – date of task created
- dateUpdate – date of task updated
The second one is TaskOperation, which contain all the method that used for doing CRUD operation on the SQLITE database.
One the TaskOperation constructor, I instantiate the TaskDBHandler classes.
In this class, it give the method like below:
- open – open database connection
- close – database connection
- addTask – to insert operation on Tasks table.
- getTask – take 1 parameter, which is id. Which will be use to find the task information that match with the id.
- getAllTask – select all task that have been created inside Task table.
- updateTask – take Task object as parameter, to update information about the task.
- RemoveTask – take task object as parameter, then do select by using getTask method to find the right task id for deletion.
In the Model package, I create 3 classes:
- AddUpdateTask – to handle the “ADD” and “UPDATE” operation on this mobile application.
- MainActivity – act as the home screen of this app, which will show menu for the Task operation like: a. CREATE TASK b. EDIT TASK c. DELETE TASK d. LIST ALL TASK
- ViewAllTask – to show all the task list that have been created by the user.
All these classes, handle the interaction from the screen/ layout that build using the XML and then connect with the TaskOperation class to do the CRUD operation on the SQLITE database.
I build 4 layout for this application, which are:
- activity_add_task.xml
- activity_main.xml
- activity_view_all_tasks.xml
- dialog_get_task_id.xml
activity_add_task.xml – layout that are used to add task into the app. 2 view element that are used inside this layout:
- EditText – to take the user input for the task name and description
- Button – to create the task based on the user input on EditText
activity_main.xml – layout for the main screen, which will show menu for Task Management mobile apps.
It use 2 view element also:
- TextView – show the title on the menu
- Button – to handle create task, edit task, delete task, update task
activity_view_all_tasks.xml – layout used to show all the list of task that are created on this mobile apps.
It is use 2 view element:
- TextView – I created it to show message when no task have been created. The default of this elemet is invisble.
- ListView – store all the task information inside it
dialog_get_task_id.xml – build to take user input for update and delete the task. It will take the id as the input. It will pop up, when we pressed button Edit Task and Delete task.
The layout consist of two element:
- TextView – show the title of dialog menu which is “enter task id”
- EditText – to take user input for the task id they want to update/delete
This layout is attach to the DialogBuilder as the layout for the popup message.