android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0

后端 未结 7 2219
甜味超标
甜味超标 2020-11-27 14:14

I am using custom adapter extending cursor adapter for displaying data in listview, to display particular phone number i have passed the id to a method in database class but

7条回答
  •  萌比男神i
    2020-11-27 15:11

    First check this Condition before fetching data

    if(cursor!=null && cursor.getCount()>0){
      cursor.moveToFirst();
      num = cursor.getString(cursor.getColumnIndex("ContactNumber")); 
    }
    

提交回复
热议问题