sub Process_Globals
Private ion As Object'Shortcut creation
End Sub
'START Shortcut creation
Sub ShortcutActivity
Dim j As Intent , j2 As Intent
Dim ACTION_PICK_ACTIVITY As String = "android.intent.action.PICK_ACTIVITY"
Dim ACTION_CREATE_SHORTCUT As String = "android.intent.action.CREATE_SHORTCUT"
Dim EXTRA_INTENT As String = "android.intent.extra.INTENT"
Dim EXTRA_TITLE As String = "android.intent.extra.TITLE"
j.Initialize(ACTION_PICK_ACTIVITY, "")
j2.Initialize(ACTION_CREATE_SHORTCUT,"")
j.PutExtra(EXTRA_INTENT, j2)
j.PutExtra(EXTRA_TITLE, "Create a system shortcut")
StartActivityForResult(j)
'Intent j;
'j = new Intent(Intent.ACTION_PICK_ACTIVITY);
'j.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT));
'j.putExtra(Intent.EXTRA_TITLE, "Create a Shortcut");
'StartActivityForResult(j, choose_app_for_shortcut);
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
Sub ion_Event (MethodName As String, Args() As Object) As Object
If Args(0) = -1 Then 'resultCode = RESULT_OK
StartActivity(Args(1))
End If
Return Null
End Sub
'END shortcut creation