1 package com.example.simpleperf.simpleperfexamplewithnative;
2 
3 import android.support.v7.app.AppCompatActivity;
4 import android.os.Bundle;
5 import android.widget.TextView;
6 
7 public class MainActivity extends AppCompatActivity {
8 
9     // Used to load the 'native-lib' library on application startup.
10     static {
11         System.loadLibrary("native-lib");
12     }
13 
14     @Override
onCreate(Bundle savedInstanceState)15     protected void onCreate(Bundle savedInstanceState) {
16         super.onCreate(savedInstanceState);
17         setContentView(R.layout.activity_main);
18 
19         // Example of a call to a native method
20         TextView tv = (TextView) findViewById(R.id.sample_text);
21         tv.setText(stringFromJNI());
22 
23         createBusyThreadFromJNI();
24     }
25 
26     /**
27      * A native method that is implemented by the 'native-lib' native library,
28      * which is packaged with this application.
29      */
stringFromJNI()30     public native String stringFromJNI();
31 
createBusyThreadFromJNI()32     private native void createBusyThreadFromJNI();
33 }
34