Reputation: 5759
For my application I am going to create a variety of abstract classes that extend the android.app.Activity and android.app.Service classes.
Upvotes: 5
Views: 5434
Reputation: 8639
You add the final subclasses to the manifest as regular Activities/Services; the abstract classes don't need to be there, as the manifest is only a lookup so the system knows which class to launch in response to an Intent
If by 'package' you mean Java package (e.g. com.mycompany.whatever), then no, just add the relevant import (or use the fully qualified name) when creating the subclass.
If by 'package' you mean APK, then yes, the abstract base should be in there with the regular code, as although it is possible to call between APKs, you this relies on classes you can instantiate. You can split the abstract classes out into an Android library project, if they're going to get re-used - Android library projects are essentially shared source, rather than traditional Java jars.
Let me know if you need more details on any of this, as this is quite a broad question, and I'd like to keep the answer size managable
Upvotes: 9
Reputation: 13062
You will add the subclasses to the manifest just like any other Activity/Service/BroadcastReciever. You do not have to add the abstract classes to the mainifest. Subclasses do not have to be in the same package as their parent if you import the parent's package.
Upvotes: 1
Reputation: 12875
You only need to include Activity classes that you are going to instantiate with an Intent. If your abstract class only exists to subclass other Activities, you shouldn't need to include it in the Manifest.
Upvotes: 2