How to get list of all Activities inside an Application / Project in android


public String[] getListOfActivitiesInApplication()
 {
 String activityArray[] = new String[0];

 Vector<String> vector = new Vector<String>();
 try
 {
 PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_ACTIVITIES);
 ActivityInfo activities[] = packageInfo.activities;

 for (int i = 0; i < activities.length; i++)
 {
 ActivityInfo activityInfo = activities[0];
 String className = activityInfo.name;
 if(className!=null)
 {
 vector.add(className);
 }
 }
 }
 catch (Exception e)
 {
 e.printStackTrace();
 vector.clear();
 }

 int size = vector.size();
 if(size>0)
 {
 activityArray = new String[size];
 vector.toArray(activityArray);
 }
 return activityArray;
 }

Advertisements

Tags: ,

About krishjlk

http://www.facebook.com/krishna.kanth.121

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: