title: android JNI: app stops working
body: <p>I'm new to android programming,I think the reason for the app to stop working lies here -> I want to return char array from <strong>JNI(in c)</strong> back to android(<strong>java</strong>) </p>
  
  <pre><code>     for(int c=0;c&lt;length;c++) {
          for (int k = 0; k &lt; 36; k++) {
              if (a[c] == string2[j]) {
                  S[c]=string2[j];
              }
          }
      }
      (*env)-&gt;ReleaseStringUTFChars(env, jstring1, str);
      return (*env)-&gt;NewStringUTF(env,S);
  </code></pre>
  
  <p>and in java:</p>
  
  <pre><code> public native String HelloWorld(String stri);
  </code></pre>
  
  <p>and since I want to put whatever the output is in a <strong>TextView</strong></p>
  
  <pre><code> t3.setText(HelloWorld(str));
  </code></pre>
  
  <p>The program runs on the emulator but once I enter something in EditText and hit a button it stops responding and then closes.</p>