views:

121

answers:

1

Hi!!!! i am new for NDK. i want to know what is the benefit of native code in android . By this can we improve our application performance. and main thing exactly when we will use this native code. please clear it. and from where i can get more information............

+2  A: 

The NDK allows you to write code using C/C++ and then link it into your Java application. You can potentially increase the speed of your application. However, it may be worth reading about Replica Island (http://code.google.com/p/replicaisland/), as they don't use the NDK, however achieve very fast frame rates.

The downsides to the NDK are, it only compiles to specific CPUs (whereas staying in Java land means it will work on any targetted version of Android).

Mark Ingram
Thanks Mark..... from where i can get it's example???
Shalini Singh
There are examples in the NDK folder when you download it
Donal Rafferty
Yes thanks "Donal" i got :)...
Shalini Singh
"Donal" i am trying to run ndk example on eclipse and following this link "http://mobilepearls.com/labs/ndk-builder-in-eclipse/" but when i am trying to set refresh tab property ,,on that place i didn't get lib folder . when i try to run my application ,, getting "java.lang.UnsatisfiedLinkError: Library helloneon not found" exception,,,,,, please guide me what is the problem....
Shalini Singh
Do you *really* need to use the NDK..?
Mark Ingram
yes, @Mark i have to work on ndk....
Shalini Singh
@Mark, you mention compiling only on specific CPU's. Most have been ARM but many high end devices are using the new Qualcomm Snapdragon. Without thinking about it (since I don't have a phone yet) I ran a test out on a friends Droid Incredible without changing anything in the way I've been compiling (just with the stock NDK instructions and MAKE). It worked fine... I'd love an explanation as looking back, I'm thinking it shouldn't have worked.
Maximus
@Maximus, the NDK supports two processors currently. The two supported devices are: * ARMv5TE (including Thumb-1 instructions) * ARMv7-A (including Thumb-2 and VFPv3-D16 instructions, with optional support for NEON/VFPv3-D32 instructions)(In the future it will support x86 too!)
Mark Ingram
@Mark So here's where my inexperience shows through... any idea why it worked okay on the snapdragon (which of those it supports)?
Maximus
By which of those, I mean which of those instruction sets...
Maximus
@Maximus, the snapdragon is the second processor (ARMv7-A).
Mark Ingram