How to list all activities exposed by an application?

前端 未结 4 1437
鱼传尺愫
鱼传尺愫 2020-12-25 07:59

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:<

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-25 08:31

    public ActivityInfo[] getActivityList() throws NameNotFoundException {
        PackageManager pm = this.getPackageManager();
    
        PackageInfo info = pm.getPackageInfo(getApplicationContext.getPackageName(), PackageManager.GET_ACTIVITIES);
    
        ActivityInfo[] list = info.activities;
    
        return list;
    }
    

提交回复
热议问题