Problem
I want to create an application that can be extended somehow by programmers. I have a set of classes that can be extended, that I provide in a jar to programmers (although I don’t like this solution that much since I can’t change the API later), and then they can extend that interface and develop their classes. The problem starts in this phase. I want to extend it through classes, not activities.
What I know
I have been reading about that subject, and people usually advise the use of intents and intent-filters to do an android pluginable application. The problem is: this tactic requires the use of activities, and it is useful to launch a set of activities that work as plugins inside a main application. I don’t want that. I need to load a set of classes in the start of my application that are external to the main project. Also I read about ClassLoaders but some solutions are kinda hacky and I couldn’t find what I wanted for my problem …
Questions
So how can I create classes that can be loaded by an application in Android? And how can I load those classes, that are developed externally, into my application?
You can still use intents without having activities. Intents and activities have little to do with each other. The only commonality is that intents also start activities. You should be really weary of using a classloader in Android, for a lot of reasons (mostly security ones). The best thing to do would be to write a “driver app” that other apps can interface to using some sort of Service: either an intent service, or using a Messenger. Either that, or using an AIDL interface (Android RPC). AIDL is going to be the most flexible (though hardest to implement?), with Intents being the simplest.