title: Integrating Omegle Chat in Android , App Crashes after some time?
body: <p>I a creating a Android app with Omegle Integration, the omegle java client is a open source project form github , it has a console client example which is working fine in java console , i am trying to insert the code in Android activity , where i want to show it in the TextView and insert my own text when needed.</p>
  
  <p>Here is my code </p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>package com.example.com.omegle.test;
  
  import org.nikki.omegle.Omegle;
  
  
  import org.nikki.omegle.core.OmegleException;
  import org.nikki.omegle.core.OmegleMode;
  import org.nikki.omegle.core.OmegleSession;
  import org.nikki.omegle.event.OmegleEventAdaptor;
  
  
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.widget.TextView;
  import android.app.Activity;
  
  public class MainActivity extends Activity {
  
      TextView txt;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          OmegleChat om=new OmegleChat();
          om.execute();
      }
  
  
      private class OmegleChat extends AsyncTask&lt;Void, Void, Void&gt; {
  
  
  
          @Override
          protected void onPreExecute() {
  
              txt=(TextView)findViewById(R.id.omegle);
              txt.append("Omegele Connection Started... \n");
  
          }
  
          @Override
          protected void onProgressUpdate(Void... values) {
  
          }
          @Override
  
          protected Void doInBackground(Void... arg0) {
              // TODO Auto-generated method stub
              OmgeleChatOn();
              return null;
          }
  
           @Override
              protected void onPostExecute(Void result) {
  
  
           }
    }
  
      public void OmgeleChatOn()
      {
  
          Omegle omegle = new Omegle();
          try {
              System.out.println("Opening session...");
  
              OmegleSession session = omegle.openSession(OmegleMode.NORMAL, new OmegleEventAdaptor() {
  
                  @Override
                  public void chatWaiting(OmegleSession session) {
                      System.out.println("Waiting for chat...");
                  }
  
  
                  @Override
                  public void chatConnected(OmegleSession session) {
                      System.out
                              .println("You are now talking to a random stranger!");
                  }
  
                  @Override
                  public void chatMessage(OmegleSession session, String message) {
                      System.out.println("Stranger: " + message);
                  }
  
                  @Override
                  public void messageSent(OmegleSession session, String string) {
                      System.out.println("You: " + string);
                  }
  
                  @Override
                  public void strangerDisconnected(OmegleSession session) {
                      System.out.println("Stranger disconnected, goodbye!");
                      //System.exit(0);
                  }
  
                  @Override
                  public void omegleError(OmegleSession session, String string) {
                      System.out.println("ERROR! " + string);
                      System.exit(1);
                  }
  
  
  
              });
  
  
  
          } catch (OmegleException e) {
              e.printStackTrace();
          }
  
  
  
      }
  }
  </code></pre>
  
  <p>Now this is the error log , the app is crashing after few seconds , stranger can reply and after his reply the app crashes like this --></p>
  
  <pre><code> 07-05 04:05:26.758: I/Process(661): Sending signal. PID: 661 SIG: 9
  07-05 04:05:58.358: I/System.out(673): Opening session...
  07-05 04:05:59.598: I/global(673): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
  07-05 04:05:59.618: I/dalvikvm(673): Could not find method org.json.JSONArray.&lt;init&gt;, referenced from method org.nikki.omegle.core.OmegleSession.fireEvent
  07-05 04:05:59.618: W/dalvikvm(673): VFY: unable to resolve direct method 3626: Lorg/json/JSONArray;.&lt;init&gt; (Ljava/lang/Object;)V
  07-05 04:05:59.618: D/dalvikvm(673): VFY: replacing opcode 0x70 at 0x003e
  07-05 04:05:59.628: D/dalvikvm(673): VFY: dead code 0x0041-0041 in Lorg/nikki/omegle/core/OmegleSession;.fireEvent (Lorg/nikki/omegle/core/OmegleEvent;Ljava/lang/Object;)V
  07-05 04:05:59.658: I/System.out(673): Waiting for chat...
  07-05 04:06:05.208: I/global(673): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
  07-05 04:06:05.218: I/System.out(673): You are now talking to a random stranger!
  07-05 04:06:09.969: I/global(673): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
  07-05 04:06:17.139: I/global(673): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
  07-05 04:06:17.149: I/System.out(673): Stranger: hlelo [: .,.
  07-05 04:06:21.378: W/KeyCharacterMap(673): No keyboard for id 0
  07-05 04:06:21.378: W/KeyCharacterMap(673): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
  07-05 04:06:28.538: D/dalvikvm(673): GC_FOR_MALLOC freed 6183 objects / 399936 bytes in 85ms
  07-05 04:06:28.538: W/KeyCharacterMap(673): No keyboard for id 0
  07-05 04:06:28.538: W/KeyCharacterMap(673): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
  07-05 04:06:28.588: I/global(673): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
  07-05 04:06:30.068: I/global(673): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
  07-05 04:06:35.708: I/global(673): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
  07-05 04:06:45.478: I/global(673): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
  07-05 04:06:45.510: W/dalvikvm(673): threadid=9: thread exiting with uncaught exception (group=0x4001d800)
  07-05 04:06:45.510: E/AndroidRuntime(673): FATAL EXCEPTION: pool-1-thread-3
  07-05 04:06:45.510: E/AndroidRuntime(673): java.lang.NoSuchMethodError: org.json.JSONArray.&lt;init&gt;
  07-05 04:06:45.510: E/AndroidRuntime(673):  at org.nikki.omegle.core.OmegleSession.fireEvent(OmegleSession.java:250)
  07-05 04:06:45.510: E/AndroidRuntime(673):  at org.nikki.omegle.core.OmegleSession.checkEvents(OmegleSession.java:204)
  07-05 04:06:45.510: E/AndroidRuntime(673):  at org.nikki.omegle.Omegle$1.run(Omegle.java:124)
  07-05 04:06:45.510: E/AndroidRuntime(673):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
  07-05 04:06:45.510: E/AndroidRuntime(673):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
  07-05 04:06:45.510: E/AndroidRuntime(673):  at java.lang.Thread.run(Thread.java:1096)
  </code></pre>
  
  <p>What could be the reason for pool 1 thread -3 exception. </p>