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));
}
分享到:
相关推荐
比如,如果你有一个名为`SubSystem`的子系统,你可以获取其输出信号的值,`get_param('YourModelName/SubSystem','OutData')`,或者设置其输入信号的值,`set_param('YourModelName/SubSystem','InData',value)`,...
This book proposes to be an integration of the theoretical aspects of java programming complemented with the implementation of the same in real world situations. The book would be all encompassing ...
Gain an in-depth knowledge of JavaScript’s data structures, and learn how different components interact with one another. Look closely at numbers, Booleans and strings, and learn how arrays, loops ...
With the release of the Raspberry Pi 2, a new series of the popular compact computer is available for you to build cheap, exciting ...Discover Raspberry Pi 2’s GPIO pins and how to interact with them
DOMException: play() failed because the user didn‘t interact with the document first.
In Pro JavaFX 2: A Definitive Guide to Rich Clients with Java Technology, Jim Weaver, Weiqi Gao, Stephen Chin, Dean Iverson, and Johan Vos show you how you can use the JavaFX platform to create rich-...
how to interact with the SQL Server 2005 database using C# 2008. This book also covers LINQ and ADO.NET 3.5, the most exciting features of .NET Framework 3.5. The chapters that shed light on database ...
Humans are innately creative. We continuously design and ...With that in mind, let's explore how we can represent a 3D design, display it to the screen, and interact with it, in 500 lines of Python.
With modules, you can closely control how JARs interact and easily identify any missing dependencies at startup. This shift in design is so fundamental that starting with Java 9, all core Java APIs ...
This expanded Third Edition adds new chapters that teach you how to interact with other tools and frameworks and build modern single-page web applications. Table of Contents Part 1 Starting with ...
Discover how the InetAddress class helps Java programs interact with DNS Locate, identify, and download network resources with Java’s URI and URL classes Dive deep into the HTTP protocol, including ...
Get to know the different ways to interact with Spark’s distributed representation of data (RDDs) Query Spark with a SQL-like query syntax See how Spark works with Big Data Implement machine learning...
Chapter 1, Package Installation and Management, explains how to install and manage the code libraries used in the book. Chapter 2, Introduction to Geospatial Code Libraries, covers the major code ...
ROS(Robot Operating System)是一个开源操作系统,专门为机器人设备和软件设计。它提供了工具和库,使得机器人系统的开发、构建和部署变得更加容易。ROS I/O 包是ROS中的一个关键组件,用于处理系统的输入和输出,...
Find out how to interact with Jenkins from within Eclipse, NetBeans, and IntelliJ IDEA Develop custom solutions that act upon Jenkins information in real time A step-by-step, practical guide to help ...