AI 149005: Change from ndk to platform's ndk (pndk), the ability to make your own java callable libraries to c code.
BUG=1857858 Automated import of CL 149005
This commit is contained in:
committed by
The Android Open Source Project
parent
c3c7479ab6
commit
429fbd82d8
@@ -0,0 +1,25 @@
|
||||
package com.example.jniexample;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class JNIExample extends Activity {
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
TextView tv = new TextView(this);
|
||||
int sum = Native.add(2, 3);
|
||||
tv.setText("Native Code test: 2 + 3 = " + Integer.toString(sum));
|
||||
setContentView(tv);
|
||||
}
|
||||
}
|
||||
|
||||
class Native {
|
||||
static {
|
||||
System.loadLibrary("native");
|
||||
}
|
||||
|
||||
static native int add(int a, int b);
|
||||
}
|
||||
Reference in New Issue
Block a user