As already suggested, you can use the PackageManager for this purpose. There are several methods that can return one or more PackageInfo objects, which in turn contain the public field ActivityInfo[] activities , if you also instruct it ... read below.
The documentation mentions the following:
An array of all tags included under, or null if there were none. This is only populated if the GET_ACTIVITIES flag is set.
Thus, make sure you specify this special flag when requesting information; for example, when using getPackageInfo(...) do:
getPackageInfo("your.package.name", PackageManager.GET_ACTIVITIES)
If you need more detailed information, you can add several flags "or":
getPackageInfo("your.package.name", PackageManager.GET_ACTIVITIES | PackageManager.GET_RECEIVERS)
Edit:
Alternatively, you can also use getActivityInfo(android.content.ComponentName, int) and catch a NameNotFoundException that will be NameNotFoundException if the requested Activity cannot be found, but in general this is considered an βabuseβ of exceptions.
Anyway, up to you.
Mh.
source share