I'm have an app that runs as a launcher with a kiosk mode. Occasionally though I need to exit and load the original launcher (in this case it's the Trebuchet launcher). I use the code below and every time the intent is not initialized.
B4X:
Dim objPackageManager As PackageManager
Dim objIntent As Intent
objIntent = objPackageManager.GetApplicationIntent ("com.cyanogenmod.trebuchet")
StartActivity(objIntent)
If I change trebuchet to filemanager that works fine to start the filemanager app.
So obviously something is different for launchers.
This code lists all the applications that can be "home" applications:
B4X:
Dim pm As PackageManager
Dim i As Intent
i.Initialize(i.ACTION_MAIN, "")
i.AddCategory("android.intent.category.HOME")
Log(pm.QueryIntentActivities(i))
That lists the trebuchet launcher and my own launcher as expected however I still have the issue whereby I get an object not initialized error on the StartActivity line:
java.lang.RuntimeException: Object should first be initialized (Intent).