diff --git a/hello-jni/app/build.gradle b/hello-jni/app/build.gradle index e542d6766..390c20fb3 100644 --- a/hello-jni/app/build.gradle +++ b/hello-jni/app/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion '23.0.2' defaultConfig { applicationId 'com.example.hellojni' - minSdkVersion 15 + minSdkVersion 23 targetSdkVersion 23 versionCode 1 versionName "1.0" diff --git a/hello-jni/app/src/main/java/com/example/hellojni/HelloJni.java b/hello-jni/app/src/main/java/com/example/hellojni/HelloJni.java index 8cf6cf749..cfef32565 100644 --- a/hello-jni/app/src/main/java/com/example/hellojni/HelloJni.java +++ b/hello-jni/app/src/main/java/com/example/hellojni/HelloJni.java @@ -24,13 +24,13 @@ public class HelloJni extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - /* Create a TextView and set its content. + /* Retrieve our TextView and set its content. * the text is retrieved by calling a native * function. */ - TextView tv = new TextView(this); + setContentView(R.layout.activity_hello_jni); + TextView tv = (TextView)findViewById(R.id.hello_textview); tv.setText( stringFromJNI() ); - setContentView(tv); } /* A native method that is implemented by the * 'hello-jni' native library, which is packaged diff --git a/hello-jni/app/src/main/res/layout/activity_hello_jni.xml b/hello-jni/app/src/main/res/layout/activity_hello_jni.xml index afb8d2fba..2ba2b634c 100644 --- a/hello-jni/app/src/main/res/layout/activity_hello_jni.xml +++ b/hello-jni/app/src/main/res/layout/activity_hello_jni.xml @@ -8,6 +8,7 @@ tools:context="com.example.hellojni.HelloJni">