I am starting to write an Android application that is going to be a reference utility.
As of the moment I am organizing the activities into packages so I would like to write a class that will list the activities in the package to the view to establish the hierarchy.
I do not know know how to ask a package for that information.
Any ideas of how to accomplish this? Tips for a better application design?
Thanks.
Its pretty straight forward if you look at the PackageManager Docs.
Here are the rough steps:
Use
Context.getPackageManager()to get an instance ofPackageManager.Then call
PackageManager.getPackageInfo()on the desire package. That will return anApplicationInfoobject which has a public memberApplicationInfo.ActivityInfo.ActivityInfois an array of all the<activity>tags from theAndroidManifest.xmlfile.If this isn’t clear read the PackageManager docs and then follow the links until you get to PackageInfo