I am wondering how to start an another app from my app using package name.
I have package name in string format like
String pkgName = \"com.example.
well, you don't want to fetch ANY class name. What you want to do is to create an Intent
out of this package name with Activity
's that can be launched (they need to have specific category
). In a single line, what you need to do is:
startActivity(getPackageManager().getLaunchIntentForPackage("com.example.appName"));
Check the documentation for PackageManager.getLaunchIntentForPackage. Generally speaking, PackageManager has a lot of interesting methods for launching apps. Here is my blog entry doing exactly that for multiple packages.