IT月光

导航

MyJni撒旦

package com.baidu.jnitest;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;

public class JNIActivity extends Activity {
    static{
        System.loadLibrary("JNITest");     
    }
        public native String stringFromJNI();

        public native double add(double a, double b);

        public native double sub(double a, double b);

        public native double multi(double a, double b);

        public native double div(double a, double b);

    
    TextView textview1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        textview1 = (TextView) this.findViewById(R.id.textview1);
        textview1.setText("加法结果"+stringFromJNI()+add(1.2,2.3));
    }
    
}

 

posted on 2016-04-27 17:10  IT月光  阅读(106)  评论(0编辑  收藏  举报