summaryrefslogtreecommitdiff
path: root/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/java/com/example/simpleperf/simpleperfexamplewithnative/MainActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'simpleperf/demo/SimpleperfExampleWithNative/app/src/main/java/com/example/simpleperf/simpleperfexamplewithnative/MainActivity.java')
-rw-r--r--simpleperf/demo/SimpleperfExampleWithNative/app/src/main/java/com/example/simpleperf/simpleperfexamplewithnative/MainActivity.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/java/com/example/simpleperf/simpleperfexamplewithnative/MainActivity.java b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/java/com/example/simpleperf/simpleperfexamplewithnative/MainActivity.java
new file mode 100644
index 00000000..4dbf4823
--- /dev/null
+++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/java/com/example/simpleperf/simpleperfexamplewithnative/MainActivity.java
@@ -0,0 +1,33 @@
+package com.example.simpleperf.simpleperfexamplewithnative;
+
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.widget.TextView;
+
+public class MainActivity extends AppCompatActivity {
+
+ // Used to load the 'native-lib' library on application startup.
+ static {
+ System.loadLibrary("native-lib");
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ // Example of a call to a native method
+ TextView tv = (TextView) findViewById(R.id.sample_text);
+ tv.setText(stringFromJNI());
+
+ createBusyThreadFromJNI();
+ }
+
+ /**
+ * A native method that is implemented by the 'native-lib' native library,
+ * which is packaged with this application.
+ */
+ public native String stringFromJNI();
+
+ private native void createBusyThreadFromJNI();
+}