I tried to use this code in a B4XPage:
but I get this error:
Here is the code of the B4XMainPage:
Is possible to use StartActivityForResult in a B4XPage? If yes, how?
Thanks in advance for any tips.
Using StartActivityForResult with JavaObject
SubName: StartActivityForResult Description: This code demonstrates how JavaObject can be used to call external APIs that should be called with Context.startActivityForResult. Same implementation in a class...
www.b4x.com
B4X:
b4xmainpage_getba (java line: 95)
java.lang.ClassNotFoundException: llections=null, b4xpages=null, button1=(Button): Left=385, Top=482, Width=321, Height=321, Tag=, Text=
, dateutils=null, ion=java.lang.Object@aae6d19, main=null
, page2=[b4xcollections=null, b4xpages=null, dateutils=null
, main=null, page2=[b4xcollections=null, b4xpages=null, dateutils=null
, main=null, page2=null, root=null
, starter=null, wobblemenu1=null, xui=null
], root=(BALayout) anywheresoftware.b4a.BALayout{1e00bf7 V.E...... ......ID 0,0-0,0 #16}
B4X:
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Public Page2 As B4XPage2
Private WobbleMenu1 As WobbleMenu
Private Button1 As Button
Public ion As Object
End Sub
'You can add more parameters here.
Public Sub Initialize
B4XPages.GetManager.TransitionAnimationDuration = 0
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
'load the layout to Root
Root.LoadLayout("lay_main")
Page2.Initialize
B4XPages.AddPageAndCreate("Page2", Page2)
End Sub
Sub B4XPage_Appear
Log("sono qui")
WobbleMenu1.SetCurrentTab(1)
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub WobbleMenu1_Tab2Click
B4XPages.ShowPage("Page2")
End Sub
Sub Button1_Click
ShowPicker
End Sub
Sub ion_Event (MethodName As String, Args() As Object) As Object
'Args(0) = resultCode
'Args(1) = intent
Return Null
End Sub
Sub GetBA As Object
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetField("processBA")
End Sub
Sub ShowPicker
Dim i As Intent
i.Initialize("android.intent.action.RINGTONE_PICKER", "")
i.PutExtra("android.intent.extra.ringtone.TYPE", 1)
StartActivityForResult(i)
End Sub
Sub StartActivityForResult(i As Intent)
Dim jo As JavaObject = GetBA
ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)
jo.RunMethod("startActivityForResult", Array As Object(ion, i))
End Sub
Thanks in advance for any tips.