Hello,
my B4XPages App is using ContentChooser to retrive an Image from the phones gallery to an imageview. In the manifest Version 28 is targeted and in the Pages creation sub the Chooser Object is initialized.
If I click on my "Open Gallery" Button the chooser is opened an let me choose an image from the gallery. After selecting the image and clicking on the upper right OK Button the App crashes with this error message in the log window. I tried different images.
....
Error occurred on line: 606 (B4XPagesManager)
java.lang.ClassCastException: anywheresoftware.b4a.objects.collections.Map$MyMap cannot be cast to java.lang.String
at anywheresoftware.b4a.keywords.Common.getComponentBA(Common.java:1218)
at anywheresoftware.b4a.keywords.Common.SubExists(Common.java:1007)
at anywheresoftware.b4a.objects.B4XViewWrapper$XUI.SubExists(B4XViewWrapper.java:722)
at TechDoc.FDM.b4xpagesmanager._backgroundstatechanged(b4xpagesmanager.java:982)
at TechDoc.FDM.b4xpagesmanager._activity_pause(b4xpagesmanager.java:593)
at TechDoc.FDM.b4xpagesdelegator._activity_pause(b4xpagesdelegator.java:78)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at TechDoc.FDM.main.onPause(main.java:275)
at android.app.Activity.performPause(Activity.java:7497)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1421)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4907)
at android.app.ActivityThread.-wrap20(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1946)
at android.os.Handler.dispatchMessage(Handler.java:109)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7367)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
....
If I use the code below then the wait is done. The sub Chooser_Result is not reached I think due to fired error before.
my B4XPages App is using ContentChooser to retrive an Image from the phones gallery to an imageview. In the manifest Version 28 is targeted and in the Pages creation sub the Chooser Object is initialized.
If I click on my "Open Gallery" Button the chooser is opened an let me choose an image from the gallery. After selecting the image and clicking on the upper right OK Button the App crashes with this error message in the log window. I tried different images.
....
Error occurred on line: 606 (B4XPagesManager)
java.lang.ClassCastException: anywheresoftware.b4a.objects.collections.Map$MyMap cannot be cast to java.lang.String
at anywheresoftware.b4a.keywords.Common.getComponentBA(Common.java:1218)
at anywheresoftware.b4a.keywords.Common.SubExists(Common.java:1007)
at anywheresoftware.b4a.objects.B4XViewWrapper$XUI.SubExists(B4XViewWrapper.java:722)
at TechDoc.FDM.b4xpagesmanager._backgroundstatechanged(b4xpagesmanager.java:982)
at TechDoc.FDM.b4xpagesmanager._activity_pause(b4xpagesmanager.java:593)
at TechDoc.FDM.b4xpagesdelegator._activity_pause(b4xpagesdelegator.java:78)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at TechDoc.FDM.main.onPause(main.java:275)
at android.app.Activity.performPause(Activity.java:7497)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1421)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4907)
at android.app.ActivityThread.-wrap20(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1946)
at android.os.Handler.dispatchMessage(Handler.java:109)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7367)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
....
If I use the code below then the wait is done. The sub Chooser_Result is not reached I think due to fired error before.
The Code:
Private Sub BTGallery_Click
Chooser.Show("image/*", "choose image")
Wait For CC_Result (Success As Boolean, Dir As String, FileName As String)
If Success = True Then
'ImageView1.Bitmap = LoadBitmap(Dir,FileName)
Else
ToastMessageShow("No Success :(",True)
End If
End Sub
Sub Chooser_Result (Success As Boolean, Dir As String, FileName As String)
End Sub