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)); } }
时间: 2024-10-25 04:45:29