android - Unable to change Image Resource in ImageView -


i have following code , unable change imageview resource in program . have similar code in fragment of program , works perfectly. have tried clean build project suggested other posting.

i tried both

status.setimagedrawable(getresources().getdrawable(r.drawable.login_tick)); status.setimageresource(r.drawable.login_cross);

@override public void onactivitycreated (bundle savedinstancestate) {     super.onactivitycreated(savedinstancestate);      status = (imageview)getactivity().findviewbyid(r.id.um_namestatus);     registerbutton = (button) getactivity().findviewbyid(r.id.um_registerbutton);      name = (edittext) getactivity().findviewbyid(r.id.um_name);      name.setonfocuschangelistener(new onfocuschangelistener() {          @override         public void onfocuschange(view v, boolean hasfocus) {             if (!hasfocus) {                 status.setimagedrawable(getresources().getdrawable(r.drawable.login_tick));                  test();             }         }     }); }  protected void test() {     // todo auto-generated method stub     status.setimageresource(r.drawable.circle_green);     toast.maketext(getactivity(), "" + "//////",toast.length_short).show(); } 


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -