Skip to content Skip to sidebar Skip to footer

Dynamically Setting Imageview.setimageuri Not Displaying Image

I have the following scenario: I am dynamically assigning an image URI to an ImageView, and then dynamically adding this ImageView to a HorizontalView. The problem is, I don't see

Solution 1:

setImageURI(Uri uri) does Bitmap reading and decoding on the UI thread . So this may cause delay in MainThread cause image size can be varry and it will take time to load . And as its on Main Thread so it can cause letency issue.

From the Documentation

setImageURI(Uri uri) does Bitmap reading and decoding on the UI thread, which can cause a latency hiccup. If that's a concern, consider using setImageDrawable(Drawable) or setImageBitmap(android.graphics.Bitmap) and BitmapFactory instead.

Effective solution is to use a Optimized ImageLoader library. You can use Glide as it is widely recommended.

Post a Comment for "Dynamically Setting Imageview.setimageuri Not Displaying Image"