开发者

How I can change the picture at runtime what ImageView show?

I make a program, with an imageView in the layout. I made a thread, I want run it. When it reac开发者_JAVA百科h the 2000 millisecond I want to change the imageview on the screen. I tried to do it with the setImageDrawable(*) (where is the drawable name, but it write ** can't be resolved). How I can do it?


Try setImageResource(int resid) and use a resource Id like R.drawable.myDrawable. If you want to use setImageDrawable then you need to pass in a Drawable, not a drawable name.

Also, not sure, but you may have issues due to the fact that your thread is not the UI thread. So if you get rid of the error, and the image isn't changing then try using AsycTask or Handler instead of a thread.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜