android - Invalidating and ImageView outside of the MainActivity thread -


my mainactivity's contentview/view can refresh using invalidate() anywhere after calling:

setcontentview(r.layout.activity_main); 

but if call dialog in item select:

@override public boolean onoptionsitemselected(menuitem item) {      switch(item.getitemid()){     case r.id.menu_tools:         showdialog();         return true;             ... 

doing not refresh imageview inside dialog:

public class toolsettingsdialog extends dialog {                 ... private void updatepreview() {     imageview image = (imageview)findviewbyid(r.id.widthimageview);      bitmap bitmap = bitmap.createbitmap(400, 400, bitmap.config.argb_8888);     canvas canvas = new canvas(bitmap);     bitmap.erasecolor(color.white);      drawing d = null;     d = box.getdrawing();     s.draw(paint, canvas);     image.setimagebitmap(bitmap);     image.invalidate();      } 

i've been looking around , can't seem understand how invalidate in different thread ui one.

dialogs drawn on ui thread, other ui operations on android. isn't problem.

also, cannot ui operations off ui thread. have perform invalidate() on ui thread, using view.postinvalidate() or activity.runonuithread().


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -