Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving a list of classes from a package in an Android project

I'm aware that it isn't easily feasible to get all of the classes in a package using reflection, but I'm wondering if someone knows of a good solution/workaround, specifically for an Android project?

Given a package, I need to be able to retrieve all of the classes from it and process annotations from them using reflection.

Does anyone know of a way to do this? Are there any libraries available?

like image 859
Tyler Treat Avatar asked Feb 13 '12 05:02

Tyler Treat


1 Answers

Scanning the filesystem as most solutions for non-Android Java do won't help on Android. Here's a (theoretical) solution that is android-specific: http://mindtherobot.com/blog/737/android-hacks-scan-android-classpath/

However, it remains a hack, since Java unfortunately does not directly support this.

like image 158
Bachi Avatar answered Sep 21 '22 18:09

Bachi