I found threads where people had troubles with invalidate because they were not on UI thread, calling sleep etc, but that doesn't apply to me. Code from onContextItemSelected, which runs on UI, right?
case CUT_ID:
if(ldb.hasRights(meta.vpath)){
RelativeLayout importBar = (RelativeLayout)findViewById(R.id.import_bar);
RelativeLayout editBar = (RelativeLayout)findViewById(R.id.edit_bar);
importBar.setVisibility(View.GONE);
editBar.setVisibility(View.VISIBLE);
clipboardVPath = meta.vpath;
ImageView thumbView = (ImageView) info.targetView.findViewById(R.id.thumbview);
thumbView.setImageResource(R.drawable.cut);
gridView.invalidate();
The thumbView.setImageResource(R.drawable.cut); has the desired effect of replacing an item in a gridview by a scissors symbol. Problem arises when I select cut on another item. Now both have the cut drawable, while I allow only 1 item to be cut. This code in getView on my custom ThumnbnailAdapter should guarantee that the view I selected cut first on should revert to a bitmap from array thumbBitmaps:
if (thumbBitmaps.size() > position) {
if(meta.vpath.equals(clipboardVPath)){
holder.img.setImageResource(R.drawable.cut);
}else{
holder.img.setImageBitmap(thumbBitmaps.get(position));
}
}
Whats wrong here?