On 11-05-19 12:50 AM, Atul Prakash wrote:
Dear Friends,
I am trying to load resources(e.g. texture images, sound files) in my
native .CPP file. As I have to use the resources like texture images
in native code, this why I am looking for any method to add them in my
native code itself.
Is this possible to add resources in my JAVA file and access these
resources in my native code? If yes then how?
Please guide me.
Atul Prakash Singh
You can load the PNG for example into a Bitmap Java side. The standard
way you normally would in Android using AssetManager. Then fetch the
pixels into an array and then read from native side. Example here:
http://lol.zoy.org/blog/2011/3/2/load-pngs-using-android-ndk
The alternative is to use libzip and unzip the apk (yes they are really
just a zip, even after signed and zipalign this still works). Once you
have used libzip to get a handle to the archive you can start reading
files. This is definitely a lot more work but depending your needs it
might be a necessity. Example here:
http://androgeek.info/?p=275
Stephen Damm
--
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