title: Android NDK : got exception randomly on orientation change
body: <p>I am trying to implement beginner NDK application .</p>
  
  <p>Program runs and giving output but sometimes on Orientation change ,</p>
  
  <p>it gives error </p>
  
  <pre><code>03-03 16:48:24.992: D/dalvikvm(21338): No JNI_OnLoad found in /data/app-lib/com.example.ndkdemo_scan-1/libnative.so 0x41fe7b90, skipping init
  
  03-03 16:48:25.018: A/libc(21338): Fatal signal 11 (SIGSEGV) at 0x5f0f605c (code=2), thread 21338 (le.ndkdemo_scan)
  </code></pre>
  
  <p>I am writing my code below :</p>
  
  <pre><code>#include &lt;jni.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  jstring Java_com_example_ndkdemo_scan_MainActivity_getString(JNIEnv * env,jobject object , jstring s){
  
      const char *string1  = (*env)-&gt;GetStringUTFChars(env,s,NULL);
  
      if(string1==NULL) return NULL;
      char *c = "input is :%s";
      printf(c,string1);
      char out[129];
      printf("Enter A String : ");
      scanf("%s",out);
      printf("String entered is :%s",out);
  
      strcat(string1,string1);
  
      jstring string_to_return = (*env)-&gt;NewStringUTF(env,string1);
      return string_to_return;
  }
  </code></pre>