List view crashing

后端 未结 5 1961
迷失自我
迷失自我 2021-01-06 12:48

I am trying to create ListView and fill it with data , but when i launch the application crashes and shows me a message

Unfortunately,…

5条回答
  •  梦谈多话
    2021-01-06 13:08

    Your constructor for the arrayadapter is incorrect.

    ArrayAdapter(this,android.R.layout.simple_list_item_1, R.id.mylist, actions);

    I believe R.id.mylist is the identifier for the listview? With this constructor it is actually expecting the identifier of the textview that is part of the layout android.R.layout.simple_list_item_1

提交回复
热议问题