Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all activities exposed by an application?

I think that it should be possible to get all the activities from 'third-party' application, described in the manifest file. I can't figure out how.

for example:

List<Activity> aList = packManager.getActivitiesForPackage("package.name");

thanks in advance!

like image 579
karla Avatar asked Nov 17 '10 23:11

karla


People also ask

Which file contains a list of activities that are used in the application?

The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

What is activity in mobile application?

An activity provides the window in which the app draws its UI. This window typically fills the screen, but may be smaller than the screen and float on top of other windows. Generally, one activity implements one screen in an app.


1 Answers

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

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

    return list;
}
like image 180
easycheese Avatar answered Oct 05 '22 23:10

easycheese