Android Question Activity.RemoveAllViews VS Activity.Finish

coslad

Well-Known Member
Licensed User
Longtime User
Hi

I noted that when i call Activity.Finish and after call another activty , sometime it happens an out of memory error , instead when i call Activity.RemoveAllViews that error doesn't become .
But Activity.Finish does not release the objects in the memory as Activity.RemoveAllViews ?

Thanks
 

coslad

Well-Known Member
Licensed User
Longtime User
I have a activity with many panels, I can go through the sliding panles with the Erel class, each panel has many ImageView loaded with loadbitmapsample.

When the user selects an ImageView, it is called an activity that contains inside a customlistview, each element has two ImageView, so I want to free up more memory as much as possible, because in some devices such as the "Galaxy Tab 2 7" "is generated Out of memory error.

But I noticed that if I call startActivity Activity.finish and after the memory is not clean, but if I call Activity.RemoveAllViews> Activity.Finish> startActivity, there is no error.

So I guess that activity.finish does not release all the memory.

You said that there is a library os to check the remaining memory available, you may publish a sampling line so that I can check what exactly happens?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

coslad

Well-Known Member
Licensed User
Longtime User
Thanks for your reply .
unfortunately the images are taken from the user with the camera , so one imageview per photo, but i found my way ,

1) first thing is to load the image in this way:

B4X:
immagine.bitmap=loadbitmapsample(cartella,nome_file,immagine.width.immagine.height)

in this way the resized bitmap will fit perfectly with the imageview.

2) For second i remove all views from the caller activity so the memory is much free as possible .
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…