@ 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