I would like only to start some applications dynamically with the package name from the app i develop, i already tried this:
intent = new Intent(Intent.ACTION_VIEW);
component = new ComponentName(getApplicationContext(), myPrefs.getString("Combo1", null));
Log.i("LOG", myPrefs.getString("Combo1", null));
intent.setComponent(component);
and
intent = pm.getLaunchIntentForPackage(myPrefs.getString("Combo1", null));
startActivity(intent);
both works and several applications opens but for others i get this error.
11-29 21:42:08.723: E/AndroidRuntime(4719): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.lock/com.sec.android.app.phoneutil}; have you declared this activity in your AndroidManifest.xml?
I understand the error(that i need to add the app/activity in manifest), so i want to know if is a workaround to add dynamically activities to manifest, or there is a way to start dynamically an application without adding to the manifest that app/activity, or there is a permission that allow to open applications ?
From my research it seems impossible, but i want to know the opinion of an expert.
Thanx in advance.
If you are talking about launching other apps from yours, this is the code you need:
You can get the main activity like this: