Game Development Reference
In-Depth Information
You updated the ProjectActivity.java file by declaring the native method with the native
keyword and no method body:
public native String getMyData();
Then you must load the native library that contains the “getMyData” method. Include this
in the static initialization block and make sure it is called before the activity instance will be
initialized:
static {
System.loadLibrary("ch02");
}
As last step you need to call the native method so that the screen content will be updated
with the new value.
Add within “onCreate” the following:
setTitle(getMyData());
In the next step, update the file named Android.mk as follows:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ch02
LOCAL_SRC_FILES := ch02.cpp
include $(BUILD_SHARED_LIBRARY)
Search WWH ::




Custom Search