How to list all activities exposed by an application?

public ActivityInfo[] getActivityList() throws NameNotFoundException {
    PackageManager pm = this.getPackageManager();

    PackageInfo info = pm.getPackageInfo(getApplicationContext.getPackageName(), PackageManager.GET_ACTIVITIES);
    
    ActivityInfo[] list = info.activities;

    return list;
}

You should be able to do just that using the PackageManager's getPackageArchiveInfo() using the GET_ACTIVITIES flag. I have not tried it though


Thanks for the answer!

I think I found a solution for listing all the activities in an application too, not the most elegant though...

//the method gets all activities for an application
private void getAppActivities() {
    PackageManager pManager = getPackageManager();
    Intent startIntent = setStartIntent();
    List<ResolveInfo> apps = pManager.queryIntentActivities(startIntent, 0);
    int count = apps.size();
    for (int i = 0; i < count; i++) {
        ResolveInfo info = apps.get(i);
        String packageName = info.activityInfo.packageName;
        Intent intent = new Intent();
        intent.setPackage(packageName);

        //activities holds the activities defined in the package
        List<ResolveInfo> activities = pManager.queryIntentActivities(intent, 0);
    }
}