cursorboundexception whille displaying listview from content provider

前端 未结 1 1250
情歌与酒
情歌与酒 2020-12-22 02:02

somebody pls get me out of this.I am trying to display a list from an sqlite database which worked absolutely fine but dont know what went wrong it showed cant find provider

相关标签:
1条回答
  • 2020-12-22 02:35

    Try this solution

     @Override
        @TargetApi(15)
        public View getView(int position, View convertView, ViewGroup parent) {
            View row = convertView;
            if (row == null) {
                row = mActivity.getLayoutInflater().inflate(mLayoutId, null, false);
            }
                Cursor list_cursor = getCursor();
                list_cursor.moveToPosition(position);
    
                if(!list_cursor.isLast()){
    
                     list_cursor.moveToNext();
                     TextView txtSecondCell = (TextView) row.findViewById(R.id.recname_row);
                     String recipename = list_cursor.getString(list_cursor.getColumnIndex(Recipe.NAME_NIC));
                     txtSecondCell.setText(recipename);
                     Log.i(TAG, "Showing List");
                }
            return row;
       }
    
    0 讨论(0)
提交回复
热议问题