#include "JniHelper.h"

JniMethodInfo t;

if (JniHelper::getStaticMethodInfo(t,"org/cocos2dx/lib/Cocos2dxActivity", "openUrl", "(Ljava/lang/String;)V")) {
jstring stringArg = t.env->NewStringUTF(_url.c_str());
t.env->CallStaticVoidMethod(t.classID, t.methodID,stringArg);

call openUrl  Parameter is _url


public static void openUrl(String url) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);



const char* text="";

const char* picture="";

const char* title="";

JniMethodInfo t;

if (JniHelper::getStaticMethodInfo(t,"org/cocos2dx/lib/ShareDialog", "shareText", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V")) {
jstring stringText = t.env->NewStringUTF(text);
jstring stringPicture = t.env->NewStringUTF(filepath.c_str());
jstring stringTitle = t.env->NewStringUTF(title);
t.env->CallStaticVoidMethod(t.classID, t.methodID,stringText,stringPicture,stringTitle);


public static void shareText(String text,String picture,String title) {
File f = new File(picture);
Uri u = Uri.fromFile(f);

String subject = "share";
int shareTitleId = m_instance.getResources().getIdentifier("share_title","string",m_instance.getPackageName());
subject = m_instance.getString(shareTitleId);

Intent intent=new Intent(Intent.ACTION_SEND);

intent.putExtra(Intent.EXTRA_STREAM, u);


JNI c++ call java More articles about

  1. C adopt JNI Reverse call JAVA Procedural methods

    JNI Reverse call JAVA Program Quote : As mentioned above java Threads ---OS Thread relationship , then C How to reverse call JAVA Procedural methods are the focus of this article 1.ThreadTest Add run() Method 2. compile ThreadTe ...

  2. cocos2d-x Use in JNI Call to JAVA Method

    use cocos2d-x published Android Project time . You should know how to use it JAVA And C/C++ Interaction involves JNI The operation of (Java Native Interface).JNI yes JAVA A general interface of . Aimed at localization ...

  3. jni Call in java Method to get the current apk The signature of md5 value

    Corresponding java Method : void getsign(Context context) throws Exception { PackageInfo localPackageInfo = context.g ...

  4. cocos2d Use in jni C++ call Java Method

    1. Sample simple data types If we Java There's one of them open Static method of , It has no parameters , There is one int The return value of . How the C++ How do I call it? ? package cb.CbCCBLE; public class Cb ...

  5. JNI——C call JAVA

    step : 1. Create a virtual machine 2. get class 3. Instantiate objects : Acquired construction method ( The method is called “<init>”), Construction parameters , Calling method 4. Calling method : It can also be divided into obtaining methods , Construction method , Calling method Operation method ...

  6. Android JNI Call JAVA Method's return type signature

    from http://blog.csdn.net/lonelyroamer/article/details/7932787 Intercepted How to sign : Let's see below. Sign How to write a signature , To represent the type of property or method to get . 1 ...

  7. NativeCode Pass through JNI Reflection call Java Layer code , In order to get IMEI For example

    In short , Is in the NativeCode Under normal circumstances, you can do something in Java code What I'm doing in my life , Like getting IMEI. This makes static analysis Java Layer code method failure . JNIEXPORT jstring JNI ...

  8. C++ call java jni.h Use

    JNI c++ call java ----------------------------------------------c++----------------------------------- ...

  9. HAL Pass through JNI call java Method 【 turn 】

    Reprint please indicate the source of this article :http://www.cnblogs.com/xl19862005 author :Xandy Because of the need of work , I've been studying HAL.JNI.Java The problem of intermodulation between methods , And made the following records and ...

Random recommendation

  1. Set the code Code Highlight in blue

    The following method is to highlight the set keywords , Taking into account the impact of comments and strings , So spare , So that it can be used in the future . private static void ColorizeCode(RichTextBox rtb) { st ...

  2. iOS pack ipa The process of installing the package

    There are also two kinds of APP releases One is . Pack it up ipa Upload it to the second place in China 3 The software market , When the user's phone has JailBreak when , Double-click the downloaded ipa File to install software (ipa Same as android Of apk The bag is the same , It's actually a compressed package ) ...

  3. Archimedes project ALS Matrix factorization algorithm application case

    from :https://github.com/ceys/jdml/wiki/ALS Archimedes project ALS Matrix factorization algorithm application case Prepared by :ceys/youyis Last update time :2014.5.12 One . Algorithm description ...

  4. Teach you to deploy step by step .net Free space OpenShift Series 4 ------ Bind domain name 、 Use CDN Speed up

    I'm sorry I don't have time these days , Some people asked me how to bind the domain name, but they didn't reply , Let's get to the point , be startled to hear ASP.Net It's open source , Don't .Net Spring is coming ? Don't bullshit , The last book said , Deployment complete ASP.Net After website , Direct access cannot access ( Um. , Public places ...

  5. Learning notes TF024:TensorFlow Realization Softmax Regression( Return to ) Recognize handwritten numbers

    TensorFlow Realization Softmax Regression( Return to ) Recognize handwritten numbers .MNIST(Mixed National Institute of Standards and Technology ...

  6. Python Basic package of Scientific Computing -Numpy

    One .Numpy Concept Numpy(Numerical Python For short ) yes Python The basic package of Scientific Computing . It provides the following functions : Fast and efficient multidimensional array objects ndarray. Used to perform element level calculations on arrays and direct logarithms ...

  7. width:100vh And min-height:calc(100vh + 51px)

    vh: Height relative to the window , that vw: Is the height relative to the window . “ Visual area ” It refers to the size of the viewing area inside the browser , namely window.innerWidth/window.innerHeight size , Does not include taskbar title bar and ...

  8. AngularJS Basics 01 from HelloWorld Speaking of

    author :arccosxy   Reprint please indicate the source :http://www.cnblogs.com/arccosxy/ preparation First , Create a file called index.html Of HTML file , The code is as follows : <!DOC ...

  9. The second online programming competition of Pango heroes &#183; Online preliminaries :AB Count

    Topic link Given two positive integers a,b, Define two sets respectively L and R, aggregate L: Namely the 1~a,1~b The set of products of integers in is defined as L = {x * y | x,y Is an integer and 1 <= x <=a , 1 <= ...

  10. 【Learning】 Fractional programming

    Fractional programming ​ Fractional programming is a kind of decision-making problem . In a general way , The topic will ask you to plan a solution to the problem , Make the cost function minimum or maximum . among , The cost function is generally in fractional form , And the constituent elements of the numerator denominator generally show one-to-one correspondence . Observe directly on the example :B ...