First steps on Android: Creating a simple Todo App

In this tutorial we are going to build a simple todo app that is able to store simple todos in a database. The user is able to add new todos or delete old ones by clicking on a todo. For this tutorial we won’t use maven to keep it simple – if maven integration is desired – take a look at this tutorial. Steps Create a new android project using the Android SDK and your IDE Create some packages com.hascode.android.activity and com.hascode.android.persistence Create the layout in res/layout/main.xml – the main elements: a listview for the todos-list, a textbox and a button to enter new data. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/widget31" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" > <TableRow android:id="@+id/row" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_below="@+id/tasklist" android:layout_alignParentLeft="true" > <EditText android:id="@+id/etNewTask" android:layout_width="200px" android:layout_height="wrap_content" android:text="" android:textSize="18sp" > </EditText> <Button android:id="@+id/btNewTask" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+string/add_button_name" > </Button> </TableRow> <ListView android:id="@+id/tasklist" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" > </ListView> </RelativeLayout> ...

April 26, 2010 · 5 min · 1056 words · Micha Kops