java - How to check if an imageview has an image in it and skip over the image to the next imageview -
kinda hangman
how skip on imageview if in , check see if in trying check imageview if there image in it
code
final boolean imagethere = mimageview17.setbackgroundresource(null); public void image6(){ randomnumber(); final int thisletter = currentletter; final boolean imagethere = mimageview17.setbackgroundresource(null); mimageview6 = (imageview) findviewbyid(r.id.imageview6); mimageview6.setimageresource(thisletter); mimageview6.bringtofront(); mimageview17 = (imageview)findviewbyid(r.id.imageview17); mimageview6.setonclicklistener(new onclicklistener() { public void onclick(view v) { // todo auto-generated method stub if (imagethere == false) { mimageview17.setimageresource(thisletter); mimageview17.bringtofront(); mimageview6.setimageresource(r.drawable.whitespace); } else { mimageview18.setimageresource(thisletter); mimageview18.bringtofront(); mimageview6.setimageresource(r.drawable.whitespace); } } }); mimageview17.setonclicklistener(new onclicklistener() { public void onclick(view v) { // todo auto-generated method stub mimageview6.setimageresource(thisletter); mimageview6.bringtofront(); mimageview17.setimageresource(r.drawable.whitespace); } }); }
basically want check imageview see if image in imageview 17 there, if is, skip on 17 , add imageresource 6 imageview18
i want make sure if imageview17 not messed when add same code imageview 6 of 7 or 8 when click on image view 17
how go fixing this?
if (mimageview17.getdrawable() != null) { // have bitmap }
the doc getdrawable
says:
return view's drawable, or null if no drawable has been assigned.
Comments
Post a Comment