Suppose Imageview accepts images that are 30x30 px. I think there is no difference, they are passed to him with setImageBitmap () or setImageResource (), in this or that case I cannot replace the image 60 times a second. Not easy because the canvass is first blocked, then drawn and then unlocked. It is unlikely that a non-blocking Imageview can assign different images so often. Before one could draw, another is already assigned, probably there is a chance to get Null while imageview is busy drawing. Or is it also blocked in Imageview native code if you assign an image to it and only then everything is displayed?

How can I often draw in ImageView (not counting canvas)

  • Ie you created an empty project, added ImageView to the markup, wrote a code that changes the image once a second and it doesn’t work? ... - YuriiSPb
  • Well, I tried, as I study, I couldn’t properly address it, I searched for imageview before setContentView. As a result, I wrote and everything works. Below in the comments to the answer, I wrote why this question was raised by me. - Turalllb

1 answer 1

ImageView is not intended for frequent rendering, but for displaying a static image on the screen, but if this question is so worried, then why didn't you try to write a simple application and test it in practice.

  • The fact is that I am just starting to learn programming and I thought that after reading this question, someone would confirm my concerns and say that you cannot often transfer the image to imageview and I don’t have to spend time first to realize it and then look the exact reason why it doesn't work. But since there was no clear hint, I implemented it. 60 times per second I transfer images of figures to a small imageview (I did the stopwatch) and everything works fine, but I don’t understand why it works. What is the difference between the principle of drawing on canvas and drawing in imageview? - Turalllb
  • the canvas has to be blocked to render. maybe imageview is also blocked, but it is no longer necessary to write about it manually. If so, everything is clear. - Turalllb