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));
}
分享到:
相关推荐
How to Interact with Simulink Models from MATLAB Scripts.zip
When I was starting out with this technology I had a lot of growing pains so this is an attempt to help those programmers who may have a need to interact with the Directory but do not want to have to ...
They show you how to use CDI in a Java SE environment with the new CDI initialization and configuration API, and how to dynamically modify the configuration of beans at application startup by using ...
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
You will get familiar with the complex communication system included in the board, so you can interact with any shield, actuator, or sensor., Later on, you will not only see how to work with data ...
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-...
Facebook applications enable you to add new ways for users to interact with each other using Facebook. Facebook applications are written in a server-side language, and hosted on the application ...
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.
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. What's Inside Updated for jQuery 3 DOM ...
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 ...
how you can interact with them. DAY 3 Learn how you can capture mouse and keyboard events and react to them in your applications. DAY 4 Learn how to work with timers in a Visual C++ applica- tion. ...
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 ...
Fast Data Processing with Spark covers everything from setting up your Spark cluster in a variety of situations (stand-alone, EC2, and so on), to how to use the interactive shell to write distributed ...
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...