Note that there are some explanatory texts on larger screens.

plurals
  1. POLaunching intent of certain android apps causes IllegalStateException
    primarykey
    data
    text
    <p>There seems to be two problems that I am having trouble with. The first case is when I launch the clock app and works perfectly, this seems to be the case when I launch most apps. </p> <p>The second case is when I try to launch an activity such as the Phone activity. When I go to get the Intent, getLaunchIntentForPackage(app.pname) returns null. Is there a different way to get the Intent of the phone activity so that I can launch it in this case?</p> <p>The third case is when I go to launch an activity such as the Camera activity. It seems that I have to have the Camera activity already within my androidManifest.xml file to launch it but is there another way to go around this? My app has the capibility to launch any app from its UI so I cannot add every single activity an android device has into my manifest file beforehand. Thank you!</p> <p>Java:</p> <pre><code> Intent launchApp = getPackageManager().getLaunchIntentForPackage(app.pname); System.out.println(Intent of " + appName + ": + " " +launchApp); if(launchApp!=null){ System.out.println("Permission granted to launch " + appName); startActivity( launchApp ); } else{ System.out.println("Permission not granted to launch " + appName); } </code></pre> <p>Logcat:</p> <pre><code> 08-07 09:38:57.031: I/System.out(1056): Intent of Clock: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.htc.android.worldclock/.WorldClockTabControl } 08-07 09:38:57.041: I/System.out(1056): Permission granted to launch Clock 08-07 09:38:59.783: I/System.out(1056): Intent of Phone: null 08-07 09:38:59.783: I/System.out(1056): Permission not granted to launch Phone 08-07 09:39:10.564: I/System.out(1056): Intent of Camera: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.android.camera/com.android.internal.app.ResolverActivity } 08-07 09:39:10.574: I/System.out(1056): Permission granted to launch Camera 08-07 09:39:10.574: D/AndroidRuntime(1056): Shutting down VM 08-07 09:39:10.574: W/dalvikvm(1056): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0) 08-07 09:39:10.614: E/AndroidRuntime(1056): FATAL EXCEPTION: main 08-07 09:39:10.614: E/AndroidRuntime(1056): java.lang.IllegalStateException: Could not execute method of the activity 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.view.View$1.onClick(View.java:2191) 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.view.View.performClick(View.java:2532) 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.view.View$PerformClick.run(View.java:9293) 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.os.Handler.handleCallback(Handler.java:587) 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.os.Handler.dispatchMessage(Handler.java:92) 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.os.Looper.loop(Looper.java:150) 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.app.ActivityThread.main(ActivityThread.java:4306) 08-07 09:39:10.614: E/AndroidRuntime(1056): at java.lang.reflect.Method.invokeNative(Native Method) 08-07 09:39:10.614: E/AndroidRuntime(1056): at java.lang.reflect.Method.invoke(Method.java:507) 08-07 09:39:10.614: E/AndroidRuntime(1056): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 08-07 09:39:10.614: E/AndroidRuntime(1056): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 08-07 09:39:10.614: E/AndroidRuntime(1056): at dalvik.system.NativeStart.main(Native Method) 08-07 09:39:10.614: E/AndroidRuntime(1056): Caused by: java.lang.reflect.InvocationTargetException 08-07 09:39:10.614: E/AndroidRuntime(1056): at java.lang.reflect.Method.invokeNative(Native Method) 08-07 09:39:10.614: E/AndroidRuntime(1056): at java.lang.reflect.Method.invoke(Method.java:507) 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.view.View$1.onClick(View.java:2186) 08-07 09:39:10.614: E/AndroidRuntime(1056): ... 11 more 08-07 09:39:10.614: E/AndroidRuntime(1056): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.camera/com.android.internal.app.ResolverActivity}; have you declared this activity in your AndroidManifest.xml? 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1565) 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1539) 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.app.Activity.startActivityForResult(Activity.java:2919) 08-07 09:39:10.614: E/AndroidRuntime(1056): at android.app.Activity.startActivity(Activity.java:3025) 08-07 09:39:10.614: E/AndroidRuntime(1056): at com.worklight.androidnativeapp.AndroidNativeApp.appClicked(AndroidNativeApp.java:284) 08-07 09:39:10.614: E/AndroidRuntime(1056): ... 14 more </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload