Cursor cannot be moved after android modifies the database

@ Override
public View getView (int position, View convertView, ViewGroup parent) {
View view;
if (convertView = = null) {
view = newView (mContext, mCursor, parent);
} else {
view = convertView;
}
notifyDataSetChanged ();
bindView (view, mContext, mCursor);
return view;
}

@ Override
public void bindView (View view, Context context, Cursor cursor) {
if (cursor.getPosition () = =-1) {
cursor.moveToNext ();
ViewHolder viewholder = (ViewHolder) view.getTag ();
viewholder.name.setText (cursor.getString (PHONES_DISPLAY_NAME_INDEX) + ");
viewholder.number.setText (cursor.getString (PHONES_NUMBER_INDEX) +");
Long contactid = cursor.getLong (PHONES_CONTACT_ID_INDEX);
Long photoid = cursor.getLong (PHONES_PHOTO_ID_INDEX);
Bitmap contactPhoto;
if (photoid > 0) {
Uri uri = ContentUris.withAppendedId (ContactsContract.Contacts.CONTENT_URI, contactid);
InputStream input = ContactsContract.Contacts.openContactPhotoInputStream (mContext.getContentResolver (), uri);
contactPhoto = BitmapFactory.decodeStream (input);
} else {
contactPhoto = BitmapFactory.decodeResource (mContext.getResources (), R.mipmap.ic_launcher);
}
viewholder.ivHead.setImageBitmap (contactPhoto);
}
}

)

whether the listview is returned after modifying the data in the newly created activity shows whether the Cursor called by bindview is called when the data is changed by two identical item or points to the last line how to modify

Mar.06,2021

cursor.moveToNext (); do not write here. When you are outside the Adaper, first query the data into a List, and bind the data directly in the Adapter

.
Menu