Memory problems

bgsoft

Well-Known Member
Licensed User
Longtime User
Hello:

I made a program that displays all images in a selected folder type "Gallery", these images the post with:
LoadBitmapSample with only 10% of X and Y.
The charge where I put a panel up to 12 images. If more than 12 I can drag the panel and get the following with the new images.
Just use two panels to give the feeling of forward and reverse. When change panel, in the previous panel images the charge with a 1 pixel image to take up less memory, also tried to remove the images RemoveAllViews, but the problem was the same.
When there are few images in the folder works fine, but when there are photos of more than 1 Mega, and for example more than 12 images, trying to see the whole picture with TouchImageView is for the program and get an error message the log: java.lang.OutOfMemoryError

How could prevent or stop the program does not capture this error to exit the application?

thanks

Jesus

:sign0013: For my bad English
 

bgsoft

Well-Known Member
Licensed User
Longtime User
Yes.

when I load a new image use this code:

Dim Bitmap1 As Bitmap
Bitmap1.Initialize(Directorio,N)
TouchImageView1.SetBitmap(Bitmap1)

SourceImageRect.Initialize(0, 0, Bitmap1.Width, Bitmap1.Height)
TouchImageViewRect.Initialize(0, 0, TouchImageView1.Width,
TouchImageView1.Height)
TouchImageView1.ScaleSrcRectToDestRect(SourceImageRect, TouchImageViewRect, "CENTER")
TouchImageView1.visible =True
TouchImageView1.BringToFront

and fail to see the image, load a picture of one pixel to occupy little memory use this code:

Dim Bitmap1 As Bitmap
Bitmap1.Initialize3(ImagenVacia.Bitmap)
TouchImageView1.SetBitmap(Bitmap1)
TouchImageView1.visible =False
TouchImageView1.SendToBack


Mark: ImagenVacia.Bitmap = 1 pixel

Thank
 
Upvote 0
Top