Java Question StartActivityForResult problem(solved)

laomms

Member
Licensed User
Longtime User
I want pop vpn prompt window like picture:
vpn.png


How to do it.

B4X:
Sub Test
    Dim i As Intent
    i.Initialize("com.android.vpndialogs.ConfirmDialog","")
    StartActivityForResult(i)
End Sub

Sub ion_Event (MethodName As String, Args() As Object) As Object
    ToastMessageShow("Args(0)=" & Args(0), True)

    Return Null
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

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

I have add permission in manifest: AddPermission(android.permission.INTERNET)
android:targetSdkVersion="29"
 
Last edited:
Top