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.appName";
That is why i am unable to fetch class name or any other valuable details from it which i can use to make a proper intent to start an activity.
Any idea how to solve this problem. Please Help!!
Thanks.
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 withActivity
's that can be launched (they need to have specificcategory
). In a single line, what you need to do is: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.