`
leili
  • 浏览: 174766 次
社区版块
存档分类
最新评论

how to interact with java object in cpp

    博客分类:
  • AnGo
阅读更多

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

    How to Interact with Simulink Models from MATLAB Scripts.zip

    How to do almost everything In active directory via C#

    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 ...

    Pro CDI 2 in Java EE 8.pdf

    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 ...

    A Textbook of Java Programming

    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 ...

    Object-Oriented JavaScript(PACKT,2ed,2013)

    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 ...

    Raspberry Pi Computer Architecture Essentials(PACKT,2016)

    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

    Internet of Things with Python

    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 ...

    Pro JavaFX 2

    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-...

    Learning Facebook Application Development.pdf

    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 ...

    Beginning C# 2008 Databases From Novice to Professional

    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 ...

    A 3D Modeller-Erick Dransch.zip

    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.

    jQuery in Action 3rd 第3版 无水印pdf 0分

    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 ...

    The Java Module System.epub

    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 ...

    jQuery.in.Action.3rd.Edition.161729207

    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 ...

    [Java] Java 网络编程 第4版 (英文版)

    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 ...

    Teach Yourself Visual C++ 6 in 21 Days

    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. ...

    Extending.Jenkins

    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

    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 ...

    Fast Data Processing with Spark 2, 3rd Edition.pdf

    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...

Global site tag (gtag.js) - Google Analytics