編輯:關於Android編程
how to interact with java object in cpp
http://www.blogjava.net/vagasnail/articles/301124.html
also frameworks\base\core\jni\android_app_NativeActivity.cpp
static const char* const kNativeActivityPathName = "android/app/NativeActivity";
#define FIND_CLASS(var, className) \
var = env->FindClass(className); \
LOG_FATAL_IF(! var, "Unable to find class " className); \
var = jclass(env->NewGlobalRef(var));
#define GET_METHOD_ID(var, clazz, methodName, fieldDescriptor) \
var = env->GetMethodID(clazz, methodName, fieldDescriptor); \
LOG_FATAL_IF(! var, "Unable to find method" methodName);
int register_android_app_NativeActivity(JNIEnv* env)
{
//LOGD("register_android_app_NativeActivity");
FIND_CLASS(gNativeActivityClassInfo.clazz, kNativeActivityPathName);
GET_METHOD_ID(gNativeActivityClassInfo.dispatchUnhandledKeyEvent,
gNativeActivityClassInfo.clazz,
"dispatchUnhandledKeyEvent", "(Landroid/view/KeyEvent;)V");
GET_METHOD_ID(gNativeActivityClassInfo.preDispatchKeyEvent,
gNativeActivityClassInfo.clazz,
"preDispatchKeyEvent", "(Landroid/view/KeyEvent;I)V");
GET_METHOD_ID(gNativeActivityClassInfo.finish,
gNativeActivityClassInfo.clazz,
"finish", "()V");
GET_METHOD_ID(gNativeActivityClassInfo.setWindowFlags,
gNativeActivityClassInfo.clazz,
"setWindowFlags", "(II)V");
GET_METHOD_ID(gNativeActivityClassInfo.setWindowFormat,
gNativeActivityClassInfo.clazz,
"setWindowFormat", "(I)V");
GET_METHOD_ID(gNativeActivityClassInfo.showIme,
gNativeActivityClassInfo.clazz,
"showIme", "(I)V");
GET_METHOD_ID(gNativeActivityClassInfo.hideIme,
gNativeActivityClassInfo.clazz,
"hideIme", "(I)V");
return AndroidRuntime::registerNativeMethods(
env, kNativeActivityPathName,
g_methods, NELEM(g_methods));
}
如果實現上下或者左右翻頁效果,我們借助下這個開源項目:https://github.com/openaphid/android-flip Aphid FlipView是一
在Android Studio上將項目導入Github上: Enable Version Control Integration... 2.選擇Git,點擊
本篇文章致那些從零開始學 Android 的或者正要學習還沒有勇氣出發的人, 希望通過我的經歷能夠讓你在學習的道路中堅持下來。我的第一份工作畢業之際通過學校的校招找到了一
本文是在我的文章android圖片處理,讓圖片變成圓形 的基礎上繼續寫的,可以去看看,直接看也沒關系,也能看懂 1、首先在res文件夾下創建一個名字為anim的