List of all activities in App

前端 未结 3 1383
借酒劲吻你
借酒劲吻你 2020-12-16 06:13

Is there any way, how to get list of all activities in running app?

I have tried:

ActivityInfo[] list = getPackageManager().getPackageArchiveInfo(
           


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 07:03

    @CommonsWare had the proper fix. The only thing I want to add for the solution (and would have just commented but you can't format comments properly) is that you don't need to hardcode your package name.

    This solution should work:

    ActivityInfo[] list = getPackageManager().getPackageInfo(getPackageName()).activities;
    

提交回复
热议问题