Android Question Is possible recycle imageview.bitmap ?

scsjc

Well-Known Member
Licensed User
Longtime User
im try:

B4X:
Dim jo = imageview.bitmap As JavaObject
jo.RunMethod("recycle", Null)

or

Dim reflector As Reflector
reflector.Target = imageview.Bitmap
reflector.RunMethod("recycle")

and always back error.
Is possible RecycleMemory from the imagesview?

thanks !!!
 

scsjc

Well-Known Member
Licensed User
Longtime User
-Im create a grid with a scrollview fill with images
-this images im use a #AdditionalJar: picasso-2.5.2 to fill images....

i'm find that for delete image cache inside picaso:
GetPicasso.RunMethodJO("invalidate", Array(imageurl))
or
GetPicasso.RunMethodJO("load", Array(imageurl)).RunMethodJO("resize", Array(fotosize, fotosize)).runmethodjo("skipMemoryCache",Null).RunMethodJO("centerCrop", Null).RunMethodJO("into", Array(iv))


but i think the ImagesView charged on Scrollview i need clear bitmap ???
is possible clear this images???
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Not sure why you are using picasso to download the images. You should use OkHttpUtils2 or ImageDownloader instead. It will give you more control over the internal cache.

The bitmaps will be released when there are no more live references pointing to them.
For example if the bitmap is set to an ImageView then you can call ImageView1.Bitmap = Null and the reference to the bitmap will be removed.

Make sure to always load images with LoadBitmapSample.
 
Upvote 0
Top