Dear All,
I modified the example in https://www.b4x.com/android/forum/threads/library-b4agallery-v3-55.24963/#content a bit:
And it did what I wanted. Then I tried moving it to the code for the app I´m working on, but got:
I tried copying my manifest over to the example app, in order to find out if something there could have any impact, but that one was still running fine.
Then I tried doing so that loading the gallery would be the very first thing happening in my own app, and nothing else would happen after that - just to see if something happening in the app would take up alot of space, but still the same.
Then I tried with
in the manifest, still no luck.
I then tried increasing the memory in the genymotion emulator from 2048 to 3172 - same result.
Then I found out that if removing gallery.showfrommediastore, things are working. Obviously this one is crucial, but maybe it gives a hint of what is going on? There are only some 15 pics in the mediastore of the device.
The reason that I´m not using the 3.55 version of the lib is that if I do so, some properties of the library from v3.10 are no longer recognized.
The app I´m working on is pretty large, and there´s a lot of things that I want to remove from it, but I doubt this would be of any help since the problem occurs even before the app has done anything else than just loaded.
Does anybody have any ideas about what´s going on here?
Thanks in advance!
I modified the example in https://www.b4x.com/android/forum/threads/library-b4agallery-v3-55.24963/#content a bit:
B4X:
Gallery.Initialize("Gallery")
Activity.AddView(Gallery, 0, 105dip, 100%x, 100%y)
'Gallery.CreateCache = "Pippo.Pluto.Paperino"
Gallery.TextSize = 16
Gallery.TextColor = Colors.Yellow
Gallery.ShowText = False
Gallery.ItemWidth = 140
Gallery.ItemHeight = 140
Gallery.Spacing = 10
'*************************************
'Gallery.ScaleType = Gallery.ScaleType.Center_Crop
Gallery.ScaleType = Gallery.ScaleType.Center_Crop
Gallery.SetNoEffect = True
Gallery.SetBorderColor=Colors.Yellow
Gallery.SetCornerRadius = 0
Gallery.SetBorderWidth = 0
Gallery.SetOval = False
'*************************************
Gallery.ShowFromMediaStore
And it did what I wanted. Then I tried moving it to the code for the app I´m working on, but got:
B4X:
java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available
java.lang.OutOfMemoryError: Failed to allocate a 12 byte allocation with 3424 free bytes and 3KB until OOM
I tried copying my manifest over to the example app, in order to find out if something there could have any impact, but that one was still running fine.
Then I tried doing so that loading the gallery would be the very first thing happening in my own app, and nothing else would happen after that - just to see if something happening in the app would take up alot of space, but still the same.
Then I tried with
B4X:
SetApplicationAttribute(android:largeHeap, "true")
I then tried increasing the memory in the genymotion emulator from 2048 to 3172 - same result.
Then I found out that if removing gallery.showfrommediastore, things are working. Obviously this one is crucial, but maybe it gives a hint of what is going on? There are only some 15 pics in the mediastore of the device.
The reason that I´m not using the 3.55 version of the lib is that if I do so, some properties of the library from v3.10 are no longer recognized.
The app I´m working on is pretty large, and there´s a lot of things that I want to remove from it, but I doubt this would be of any help since the problem occurs even before the app has done anything else than just loaded.
Does anybody have any ideas about what´s going on here?
Thanks in advance!