Friday, May 20, 2011

[android-developers] Re: How to load resources like texture images & sound files in native code?

The example basically involves loading up the PNG Java side using the
Android Bitmap class. Then exposing some Java functions to the native
side so the native side can ask for the bytes of the image.

Which part is giving you trouble? I'll guide as best I can.


On May 19, 2:10 am, Atul Prakash <atul.prakas...@gmail.com> wrote:
> Dear Stephen,
>
> I am new to Android Development through native code. As per your
> directions, I followed the examplehttp://lol.zoy.org/blog/2011/3/2/load-pngs-using-android-ndk
>
> Unfortunately, I am not able to fully understand it. I am bit confused
> about its integration with actual code. Plz help.
>
> Rgds/Atul Prakash Singh
>
> On May 19, 11:56 am, Stephen Damm <shinhalsa...@gmail.com> wrote:
>
>
>
>
>
>
>
> > 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate