Hello again,

Thanks for the input.  I got access to the add-on's resources by using:

Resources r = getPackageManager().getResourcesForApplication("com.my.app");
String[] myArray = r.getStringArray(0x7f040000);

But as you can see, I have to use the int for the resource and not the
resource id.  Is there a way to reference the resource id instead, or is
this not possible?  Or, would this work just fine with the resource id, but
Eclipse simply reports it as an error.

On Fri, Jan 21, 2011 at 4:54 AM, Mark Murphy <[email protected]>wrote:

> Your Java class approach will never work.
>
> You can access resources of another app through PackageManager and
> getResourcesForApplication().
>
> On Fri, Jan 21, 2011 at 1:34 AM, Logan Masten <[email protected]>
> wrote:
> > Hello,
> > I am creating an application that will have a lot of data that will not
> > appeal to everyone, so I want to create add-ons instead of forcing users
> to
> > download a larger app.
> > What I am hoping to do, to keep things more organized, is call a public
> > method from the add-on and have it return a string or array (or if not
> > possible, just access the res folder itself).
> > I have been attempting to do so by getting the application context:
> > Context context = createPackageContext("com.myaddon",
> CONTEXT_INCLUDE_CODE);
> > then either reference a class:
> > Class<?> c = context.getClassLoader().loadClass("MyClass");
> > and call the method ( getString() ) off the class:
> > c.getString();
> > which gives the error:
> > The method getString() is undefined for the type Class<capture#2-of ?>
> > Or trying to access the resources through:
> > Resources otherRes = context.getResources();
> > otherRes.getStringArray(R.array.myArray);
> > But this always gives a cannot be resolved error.  Does anyone have any
> > thoughts on what I am doing wrong?  I have never done anything like this
> > before, so I'm probably doing plenty wrong, but I'm having trouble
> finding
> > more information.
> > Thanks for the help!
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%[email protected]>
> > For more options, visit this group at
> > http://groups.google.com/group/android-developers?hl=en
>
>
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
> Available!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to