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 are so important you may actually be willing to sacrifice performance in some cases (although make sure the user experience does not suffer, or at least does not suffer beyond an acceptable threshold). Like many developers, your resources are limited, yet you want to reach as many people as possible with your applications. Limiting yourself to a single platform won't maximize your investments.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.178.234