Hi Guys,
I have an app where I use BBCodeView lib to display the app help. the .text contains text and few, about 15, pgn (very small files, few Kb, max 100Kb).
On few devices I get some crashes from the google play console which seems indicating some issues with loading some pictures. Here attached an extract of the crash log.
java.lang.OutOfMemoryError:
at dalvik.system.VMRuntime.newNonMovableArray (Native Method)
at android.graphics.Bitmap.nativeCreate (Native Method)
at android.graphics.Bitmap.createBitmap (Bitmap.java:939)
at android.graphics.Bitmap.createBitmap (Bitmap.java:912)
at android.graphics.Bitmap.createBitmap (Bitmap.java:843)
at android.graphics.Bitmap.createScaledBitmap (Bitmap.java:719)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Resize (CanvasWrapper.java:568)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.InitializeResize (CanvasWrapper.java:549)
at anywheresoftware.b4a.keywords.Common.LoadBitmapResize (Common.java:1370)
at anywheresoftware.b4a.objects.B4XViewWrapper$XUI.LoadBitmapResize (B4XViewWrapper.java:713)
at gigiosoft.MQTTAlert.bbcodeparser$ResumableSub_SetImageView.resume (bbcodeparser.java:737)
at gigiosoft.MQTTAlert.bbcodeparser._setimageview (bbcodeparser.java:561)
at gigiosoft.MQTTAlert.bbcodeparser._texttorun (bbcodeparser.java:905)
at gigiosoft.MQTTAlert.bbcodeparser._createruns (bbcodeparser.java:148)
at gigiosoft.MQTTAlert.bbcodeview._parseanddraw (bbcodeview.java:490)
at gigiosoft.MQTTAlert.bbcodeview._settext (bbcodeview.java:558)
at gigiosoft.MQTTAlert.main._setwizard (main.java:17101)
at gigiosoft.MQTTAlert.main._activity_create (main.java:1962)
............................
the code is already within a Try/Catch but for some reasons it does not get caught.
I have checked and I am not using the latest BCTextEngine as I am using 1.87. Can that be something fixed with 1.88 or 1.89? Anything I could try to identify what is causing this out of memory and understand why it affects only some devices?
thanks!
I have an app where I use BBCodeView lib to display the app help. the .text contains text and few, about 15, pgn (very small files, few Kb, max 100Kb).
On few devices I get some crashes from the google play console which seems indicating some issues with loading some pictures. Here attached an extract of the crash log.
java.lang.OutOfMemoryError:
at dalvik.system.VMRuntime.newNonMovableArray (Native Method)
at android.graphics.Bitmap.nativeCreate (Native Method)
at android.graphics.Bitmap.createBitmap (Bitmap.java:939)
at android.graphics.Bitmap.createBitmap (Bitmap.java:912)
at android.graphics.Bitmap.createBitmap (Bitmap.java:843)
at android.graphics.Bitmap.createScaledBitmap (Bitmap.java:719)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Resize (CanvasWrapper.java:568)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.InitializeResize (CanvasWrapper.java:549)
at anywheresoftware.b4a.keywords.Common.LoadBitmapResize (Common.java:1370)
at anywheresoftware.b4a.objects.B4XViewWrapper$XUI.LoadBitmapResize (B4XViewWrapper.java:713)
at gigiosoft.MQTTAlert.bbcodeparser$ResumableSub_SetImageView.resume (bbcodeparser.java:737)
at gigiosoft.MQTTAlert.bbcodeparser._setimageview (bbcodeparser.java:561)
at gigiosoft.MQTTAlert.bbcodeparser._texttorun (bbcodeparser.java:905)
at gigiosoft.MQTTAlert.bbcodeparser._createruns (bbcodeparser.java:148)
at gigiosoft.MQTTAlert.bbcodeview._parseanddraw (bbcodeview.java:490)
at gigiosoft.MQTTAlert.bbcodeview._settext (bbcodeview.java:558)
at gigiosoft.MQTTAlert.main._setwizard (main.java:17101)
at gigiosoft.MQTTAlert.main._activity_create (main.java:1962)
............................
the code is already within a Try/Catch but for some reasons it does not get caught.
I have checked and I am not using the latest BCTextEngine as I am using 1.87. Can that be something fixed with 1.88 or 1.89? Anything I could try to identify what is causing this out of memory and understand why it affects only some devices?
thanks!
B4X:
Try
BBCodeView1.ParseData.DefaultFont = xui.CreateDefaultFont(20/access.GetUserFontScale)
'[Alignment=Center][TextSize=20][b]Title[/b][/TextSize][/Alignment]
BBCodeView1.Text = _
$"
xxxxxxxxxxx xkxlkj j j lkj lkj lj lòkj lj lkj l klj lkjk.
You can configure bla bla a [b]local[/b] or a [b]cloud[/b] bla bla.bla bla
[img FileName="image_1.png" width=340 height=240/]
this APP bla blah xxxxxxx
[img FileName="image_2.png" width=340 height=240/]
Configuration is xxxxxxx"$
Catch
Log(LastException)
End Try