Hello all.

I'm trying to build a todo-list using a ListView, but I'm having
problems, as when I launch that list, I get errors.

This is my XML file defining the list itself (tasks.xml):

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
      android:layout_width="wrap_content"
        android:layout_height="wrap_content">

    <ListView android:id="@+id/android:list"
          android:layout_width="fill_parent"
                android:layout_height="fill_parent"/>
        <TextView android:id="@+id/android:empty"
          android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/no_tasks"/>
</LinearLayout>

This is my XML file defining a row in the list (tasks_list_row.xml):

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
        <CheckBox android:id="@+id/checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        <TextView android:id="@+id/task_title"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
</LinearLayout>

So, in my class (that extends ListActivity) I call the list this way:

setContentView(R.layout.tasks);
final String[] items = new String[] { "one", "two", "three" };
setListAdapter(new ArrayAdapter<String>(this, R.id.task_title,
R.layout.tasks_list_row, items));


When I run my app, I get this error:

android.content.res.Resources$NotFoundException: Resource ID
#0x7f050006 type #0x12 is not valid


How could I avoid this error? What am I doing wrong?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to