问题
I have two application. I want to intent to the second one from the first one. But the second application must be launched from first one. So i have to hide the second one's icon.
When i delete the category tag from the second one's manifest.xml, icon is disappearing. But this time i can't launch the second app from the first app with intent.
This is how i tried to intent:
Intent openvideo = getPackageManager().getLaunchIntentForPackage("air.deneme");
startActivity(openvideo);
How can i handle it?
Both of the applications are view based, they aren't background applications.
回答1:
ComponentName lComponentName= new ComponentName(yourPackageNameOFApplication2, yourPackageNameOFApplication2.YourMainActivityOfApplication2);
try {
Intent i = new Intent(Intent.ACTION_MAIN);
i.setComponent(lComponentName);
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
// Write Toast , we will have an exception if the second application is not installed
}
来源:https://stackoverflow.com/questions/20771767/intent-to-hidden-application-on-android