List of all of the activities in our application that are running on the device

后端 未结 2 625
忘了有多久
忘了有多久 2020-12-30 04:50

How to get the list of all activities in our application that are running on the device.

For example: pdf generation and email activities included.

I can che

2条回答
  •  无人及你
    2020-12-30 05:35

    This is the way to get all the running activities in the application -

    try {
        ActivityInfo[] list = getPackageManager().getPackageInfo(getPackageName(),PackageManager.GET_ACTIVITIES).activities;
    
            for(int i = 0;i< list.length;i++)
            {
                System.out.println("List of running activities"+list[i].name);
    
            } 
        }
    
        catch (NameNotFoundException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    

提交回复
热议问题