Pages

Thursday, January 23, 2014

How to run existing Android Apps from another application or create launcher

This is script to make a launcher or call another android app from others.

PackageManager pm=getPackageManager();
Intent intent=pm.getLaunchIntentForPackage("com.yourcompany.package_name"));
if (intent!=null){
   startActivity(intent);
}

If you run from a fragment, you must add Context before you get a PackageManger, and the script is :

PackageManager pm=mContext.getPackageManager();
Intent intent=pm.getLaunchIntentForPackage("com.yourcompany.package_name"));
if (intent!=null){
   mContext.startActivity(intent);
}

Let's try for your own Android application.


No comments: