Skip to content

Most visited

Recently visited


ANativeActivity Struct Reference

ANativeActivity Struct Reference

#include <native_activity.h>

Data Fields

struct ANativeActivityCallbackscallbacks
JavaVM * vm
JNIEnv * env
jobject clazz
const char * internalDataPath
const char * externalDataPath
int32_t sdkVersion
void * instance
const char * obbPath

Detailed Description

This structure defines the native side of an It is created by the framework, and handed to the application's native code as it is being launched.

Field Documentation

◆ assetManager

AAssetManager* assetManager

Pointer to the Asset Manager instance for the application. The application uses this to access binary assets bundled inside its own .apk file.

◆ callbacks

struct ANativeActivityCallbacks* callbacks

Pointer to the callback function table of the native application. You can set the functions here to your own callbacks. The callbacks pointer itself here should not be changed; it is allocated and managed for you by the framework.

◆ clazz

jobject clazz

The NativeActivity object handle.

IMPORTANT NOTE: This member is mis-named. It should really be named 'activity' instead of 'clazz', since it's a reference to the NativeActivity instance created by the system for you.

We unfortunately cannot change this without breaking NDK source-compatibility.

◆ env

JNIEnv* env

JNI context for the main thread of the app. Note that this field can ONLY be used from the main thread of the process; that is, the thread that calls into the ANativeActivityCallbacks.

◆ externalDataPath

const char* externalDataPath

Path to this application's external (removable/mountable) data directory.

◆ instance

void* instance

This is the native instance of the application. It is not used by the framework, but can be set by the application to its own instance state.

◆ internalDataPath

const char* internalDataPath

Path to this application's internal data directory.

◆ obbPath

const char* obbPath

Available starting with Honeycomb: path to the directory containing the application's OBB files (if any). If the app doesn't have any OBB files, this directory may not exist.

◆ sdkVersion

int32_t sdkVersion

The platform's SDK version code.

◆ vm

JavaVM* vm

The global handle on the process's Java VM.

The documentation for this struct was generated from the following file:
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)