Android's internal resources

Put your problem here if it does not fit any of the other categories.

Android's internal resources

Postby Quetzalcoatl » Sun Jan 18, 2009 3:13 pm

Right, apologies for polluting the board with a similar topic but it's confusing me somewhat :?

Android.jar contains resources (images etc) that they use internally via ~~~.getResources(~~~,com.android.internal.R.drawable.filename)

What I'm trying to work out (even after downloading the source code) is how they do this without an internal R.Java so enumerate their drawables etc. I want to have my own jar file that does some common application setup etc but it needs to contain some resources (text files and images).
How on earth does Google do it with Android? as they are calling com.android.internal.R they must have some R class defined that I can't find that links the internal (non-public) resources to the code.

Anyone got any idea how the achieve this? or pointers in an alternate direction please?

Cheers,
Steve
Image
Quetzalcoatl
Senior Developer
Senior Developer
 
Posts: 129
Joined: Sat Oct 18, 2008 8:21 pm
Location: near Manchester, UK

Top

Postby Quetzalcoatl » Mon Jan 19, 2009 6:14 pm

Problem solved by moving the required resources to the Assets folder and using the following code.

Code: Select all
InputStream is = Application.getInstance().getAssets().open("image.png");

BitmapFactory.decodeStream(is);


Application.getInstance is just a static singleton instance created around the Activity that the new jar will be contained within :? :)
Image
Quetzalcoatl
Senior Developer
Senior Developer
 
Posts: 129
Joined: Sat Oct 18, 2008 8:21 pm
Location: near Manchester, UK

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 20 guests