Android Eve
Android Eve

Reputation: 14974

What can't the NDK be used for?

From the official NDK site:

The Android NDK... provides headers and libraries that allow you to build activities, handle user input, use hardware sensors, access application resources, and more, when programming in C or C++. If you write native code, your applications are still packaged into an .apk file and they still run inside of a virtual machine on the device. The fundamental Android application model does not change.

Yet, it is always described as a companion tool to the Android SDK and as a toolset that allows to "implement parts of your applications using native-code languages such as C and C++".

My understanding from this is that, unlike the Java based SDK, the NDK is not designed to implement certain parts of an Android application.

Is this correct?

If so, what parts doesn't the NDK allow implementing?

Upvotes: 2

Views: 683

Answers (2)

Seva Alekseyev
Seva Alekseyev

Reputation: 61380

Check out NDK r5 (released Dec 2010). They've added a lot of support for native C++ coding, including native activities.

Upvotes: 0

Leif Andersen
Leif Andersen

Reputation: 22332

It's important to note that the documentation you're referring to was around before the ndk was actually capable of dealing with things such as activities, and whatnot. As such, back then what you would need to do is create an android app with the sdk, and at a bare minimum, you needed to create a java wrapper class for the activity lifecycle events, which called native code. Also, if you wanted sound, or other interactions with the user, you would often have to use the sdk for that too.

Now however, it seems like you could potentially use the NDK for an entire app (although I haven't tried it yet), but if you wanted to use standard UI elements, such as a list to select a game file, I would still use the SDK for that.

Upvotes: 4

Related Questions