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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en