views:

51

answers:

1

I have a fully functioning program that worked. However it had two dialogs that I know I'll be reusing every time I write a program, or potentially multiple times per program. They are a EULA and an info page. So I've moved the two activities to their own project, however I don't want to have a standard EULA and info page obviously. So I have the resource on the projects I'm working on. (If using Assets will work better, I could change that.)

For the EULA I have a static function checkEULA to see if it's already been accepted and that works because I pass in an activity and the resource ID.

However for the InfoActivity I am trying to do it as a pure Intent.. I can pass in the id into the bundle, but is there a way to get the activity or resources from the intent with out adding it into the bundle?

Or if not, what is there a best practice, or a smart way to pass a resource into a intent to get it out on the other end?

+1  A: 

You can probably do this using the PackageManager class. I believe it will allow you to access the resources from any package on the system.

http://developer.android.com/reference/android/content/pm/PackageManager.html#getResourcesForApplication(java.lang.String)

That being said, I'm curious how you plan to distribute this. Are you going to tell the user to download two different packages from the Android Market?

You might want to consider looking into the library project support that was added in the latest version for the Android SDK tools:

http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject

http://developer.android.com/guide/developing/other-ide.html#libraryProject

Trevor Johns
It looks like when I create a library project, I don't need to share my resources, which makes this easy. I was looking to make this into a Library project. (Side note.. The documentation on this is missing one step.. You have to add the src files to the Java Build Path. in addition to everything else.)
Kinglink