You must supply a resource ID for a TextView android error

I’m pretty sure the problem lies in your conversation_item layout. The docs state that you must provide a resource with a single TextView. What does that layout look like?

As an example, this is what the simple_list_item_1 layout looks like, yours should be pretty similar.

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:gravity="center_vertical"
    android:paddingLeft="6dip"
    android:minHeight="?android:attr/listPreferredItemHeight"
/>

EDIT:

I just edited the question so your layout will show. Your layout is indeed wrong, you cannot have the linear layout there if you’re using that constructor. You can use the other constructor ( ArrayAdapter(Context context, int resource, int textViewResourceId, T[] objects) ) and provide your custom layout and your TextView’s id.

Leave a Comment