我试图从SQLite DB删除一行后刷新我的listview。
这是其中的一部分:

cursor = mysqlAdapter.fetchAll(); // a method from sqlite adater class
ArrayList<MyInfo> vidRows = new ArrayList<MyInfo>();
if (cursor.moveToFirst()) {
do { ...... }
while (cursor.moveToNext()); }
mList.setAdapter(new SomeAdapter(this, vidRows));
mList.setOnItemClickListener(this);
registerForContextMenu(mList); }


然后在我的getView我做:

public View getView(int position, View convertView, ViewGroup parent) {
View vidRow = inflater.inflate(R.layout.queue_row, null);
ImageView vidThumb = (ImageView) vidRow .findViewById(R.id.Thumb);
Bitmap bmThumbnail; bmThumbnail = ThumbnailUtils.createVideoThumbnail(
                     getFullpath(vidItems.get(position).my_id), Thumbnails.MINI_KIND);
vidThumb.setImageBitmap(bmThumbnail);
TextView vidText = (TextView) vidRow .findViewById(R.id.vid_cap);
videoText.setText(vidItems.get(position).my_cap); return vidRow; }

最佳答案

您在使用游标吗?如果是这样,您可以致电:

cursor.requery();

08-16 06:31