android - Imageview doesn't load the image programatically -


i have layout imageview component want load image programatically

i tried load image file , drawable resource, in oncreate() event , when button pressed no image loaded , no error thrown.

i'm using .invalidate() method without results

example drawable resource (monodroid code)

imageview ivstock = view.findviewbyid<imageview>(resource.id.iv01); 

way 1:

ivstock.setimageresource(resource.drawable.circle_green); 

way 2:

ivstock.setbackgroundresource(resource.drawable.circle_green); 

way 3:

ivstock.setimagedrawable(resources.getdrawable(resource.drawable.circle_green)); 

and ever

ivstock.invalidate(); 

i tried task in thread , in task. think i'm missing , don't know what.

edit 1: tried in same activity/layout , works fine

btnok.setbackgrounddrawable(resources.getdrawable(resource.drawable.circle_green)); 

could bug?

any appreciated in advance

solved

sorry folks, defining ivstock inside view

view view = layoutinflater.inflate(resource.layout.visorimagenes, null, false); imageview ivstock= view.findviewbyid<imageview>(resource.id.imagenstock); 

and doing view, ivstock wasn't in layout/activity ambit

imageview ivstock= findviewbyid<imageview>(resource.id.imagenstock); 

is proper code

thanks all!


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -