You must supply a resource ID for a TextView android error

后端 未结 4 1808
清酒与你
清酒与你 2020-12-03 10:08

I try all this day to resolve this error. I don\'t understand why my logcat prints:

05-06 21:45:59.559:
ERROR/ConversationList(9023): We have
chats... 05-06 21:45:         


        
4条回答
  •  醉话见心
    2020-12-03 10:58

    Had the same problem, needed to change the custom adapter from:

      ListAdapter adapter = new ArrayAdapter(
                this,
                R.layout.conversation_item,
                chatList
            );
        getListView().setAdapter(adapter);
    

    to:

      ListAdapter adapter = new ArrayAdapter(
                this,
                R.layout.conversation_item,
                R.id.sometextview_from_the_layout,
                chatList
            );
        getListView().setAdapter(adapter);
    

    I think the selected TextView will be used to generate the rowid, which may explain its need to be unique, but I'm not sure yet.

提交回复
热议问题