开发者

How to know whether an image is displayed in ImageView?

开发者 https://www.devze.com 2023-03-21 14:52 出处:网络
I am trying to display some images in one ImageView to obtain the functionality of slide show. I am registering an Animation Listener to the imageview for changing each picture.

I am trying to display some images in one ImageView to obtain the functionality of slide show.

I am registering an Animation Listener to the imageview for changing each picture.

When slide show is displaying, some of the images are not visible, but its memory is allocating.

I am converting images from URL to bitmap. After doing inSampleSize = 4, I am setting the bitmap to ImageView.

Why these images are not visible? the images with below 100 Kb are visible, but with 500kb has the problem.开发者_如何学运维

Thanks..

EDITED

Actually when the application launches, the images from the URL are converted to bytes and it is stored in the DB. And when we click on the Slide show button in another activity, these bytes are converted to bitmap and showed by the ImageView.


If your images are larger than a few kB, it is best practice to use a ContentProvider rather than loading these images directly from storage. This may be your problem.

http://developer.android.com/guide/topics/providers/content-providers.html#querying

Give this a read and try the ContentResolver.openInputStream and Cursor.getBlob() method of retrieving images, and see if it works any better for you.

Hope this helps!


Sorry all, Finally I figured out the problem.

I increase the duration of animation according to image size. Now all images are displaying fine.

0

精彩评论

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