my dog learned polymorphism*
The moose likes Android and the fly likes Developing for android using NDK Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Developing for android using NDK" Watch "Developing for android using NDK" New topic
Author

Developing for android using NDK

Ashley Riot
Greenhorn

Joined: Nov 16, 2011
Posts: 25
Does the NDK provide all the tools and utilities that can be found in Java SDK? Is there an advantage to developing using the SDK instead of the NDK?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42590
    
  65
The NDK provides access to a small set of native libraries (http://developer.android.com/tools/sdk/ndk/index.html#Tools), like OpenGL. And it has provisions for letting you implement methods in C/C++, going so far as making it possible to implement the entire lifecycle of an Activity in native code if you need to. It does not make available all the Java libraries to C code.


Ping & DNS - my free Android networking tools app
Jeffrey Friesen
Author
Ranch Hand

Joined: Dec 29, 2012
Posts: 67
    
    5

Hi Ashley,

A few months ago, I wrote about the Android NDK for Apress's "Android Recipes, Second Edition" book, which is being promoted on JavaRanch this week.

My NDK chapter (which also covers Renderscript) discusses NDK installation, explores the various tools that the NDK makes available, itemizes NDK examples that are part of the NDK, and provides sample programs. The first sample, NDKGreetings, presents the Java and C sides of what I'd call a hybrid app. The Java side loads a native NDKGreetings library and proceeds to invoke its getGreetingMessage() native method in the app activity's onCreate() method. The C side uses JNI to return a message from the native equivalent of getGreetingMessage(). Moving forward from this simple JNI demo, I present low-level and high-level native activities in the C language. I show how to create and run all of these examples in command-line and Eclipse IDE contexts. I believe this chapter (8) will answer your questions for you.

All the best.

Jeff Friesen
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Developing for android using NDK