Summary
We have seen how the use of native code can improve performance. Even though carefully crafted native code rarely results in a degradation of performance, performance is not the only reason why you should use the NDK. The following are all good reasons why you should use it:
- You want to reuse existing code instead of having to rewrite everything in Java.
- You want to write new code to use on other platforms that don't support Java.
- You want to target older Android devices that do not have a Just-In-Time compiler (Android 2.1 and earlier), and native code is the only way to offer a good user experience.
- Using native code in your application makes the user experience better, even on Android devices with a JIT compiler.
The first two reasons ...