I’m trying to allow a user to supply a class name and then launch the Activity but I keep getting an error stating:
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.intel.ave.androidclient/com.android.vending}; have you declared this Activity in your AndroidManifest.xml?
I haven’t placed it in my Manifest as I won’t know what the user wants at runtime.
//package_name = input from the user
//MyContext = the activity context
Intent newprocess = new Intent(Intent.ACTION_MAIN);
newprocess.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
newprocess.setClassName(MyContext, package_name);
MyContext.startActivity(newprocess );
Starting an external activity with an intent is a bit different than starting within your app. See calling activity from external Activity. Quoting from there, you would use this instead