java - Reloading android view in a fragment -
i'm using android eclipse while working on project user can save , upload notes images.
i have fragment holds textview , thumbnail images. user can add additional images using camera , can remove images viewing(clicking) image (in separate activity) , deleting it.
my problem refreshing layout of fragment reflect deleted image. following function being called deal this:
public viewgroup removenoteimagefromview(string location) { list<string> imagelinks = new arraylist<string>(); (string string : imagelocations) { if (string.equalsignorecase(location)) { break; } imagelinks.add(string); } //remove imageviews linear layout linearlayout linear = (linearlayout) rootview.findviewbyid(r.id.imagecontainer); if (linear.getchildcount() != 0) { linear.removeallviewsinlayout(); linear.refreshdrawablestate(); linear.postinvalidate(); } imagelocations.addall(imagelinks); //add them new array string root = environment.getexternalstoragedirectory().tostring(); (string string : imagelinks) { bitmap mybitmap = bitmapfactory.decodefile((new file(root +"/saved_images/"+string)).getabsolutepath()); addimage(mybitmap); } return linear; }
all code hide thumbnails called linear.removeallviewsinlayout(). following 2 line thought reload layout on screen appear have no effect whatsoever.
please note have tried linear.invalidate() postinvalidate , still nothing.
the correct image deleted device dealt elsewhere when go fragment reselecting in menu displayed correctly.
replace this:
linear.refreshdrawablestate(); linear.postinvalidate();
with this:
linear.requestlayout();
Comments
Post a Comment