Home | History | Annotate | Download | only in neon
      1 package com.example.neon;
      2 
      3 import android.app.Activity;
      4 import android.os.Bundle;
      5 import android.widget.TextView;
      6 
      7 public class HelloNeon extends Activity
      8 {
      9     /** Called when the activity is first created. */
     10     @Override
     11     public void onCreate(Bundle savedInstanceState)
     12     {
     13         super.onCreate(savedInstanceState);
     14         /* Create a TextView and set its content.
     15          * the text is retrieved by calling a native
     16          * function.
     17          */
     18         TextView  tv = new TextView(this);
     19         tv.setText( stringFromJNI() );
     20         setContentView(tv);
     21     }
     22 
     23     /* A native method that is implemented by the
     24      * 'helloneon' native library, which is packaged
     25      * with this application.
     26      */
     27     public native String  stringFromJNI();
     28 
     29     /* this is used to load the 'helloneon' library on application
     30      * startup. The library has already been unpacked into
     31      * /data/data/com.example.neon/lib/libhelloneon.so at
     32      * installation time by the package manager.
     33      */
     34     static {
     35         System.loadLibrary("helloneon");
     36     }
     37 }
     38