ArrayAdapter number of elements in data set is zero

后端 未结 1 967
北荒
北荒 2021-01-05 16:13

I\'m trying to build a list with a customized view for the rows, each row will consist of an image view and two text views.

in order to do so i extended the ArrayAda

相关标签:
1条回答
  • 2021-01-05 17:03

    Make sure getCount() is properly implemented so :

         @Override
         public int getCount(){
               return posters!=null ? posters.length : 0;
         }
    

    EDIT: by calling the

       ArrayAdapter(Context context, int textViewResourceId)
    

    constructor you are not passing your array of objects to the constructor.

    You should be calling the

       ArrayAdapter(Context context, int textViewResourceId, T[] objects)
    

    constructor which also takes as parameter the array of objects.

    0 讨论(0)
提交回复
热议问题