title: data is not emitted from android client to server using socket.io library
body: <p>I am creating a chat app using socket.io library. The github link to library is com.github.nkzawa:socket.io-client:0.3.0 . I wanted to add the feature of adding channels by the users. For that I am emitting the channel name and description, but the problem is that data is not emittted to the server. I have done the debugging, but I can't detect where is the problem.The code is given below:
  <strong>HomeActivity.java</strong></p>
  
  <pre><code>public class HomeActivity extends AppCompatActivity implements AlertDialogueBoxInterface {
  
  private Socket mSocket;
  private Boolean isConnected = true;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_home);
  RoundTableApplication app = (RoundTableApplication) this.getApplication();
      mSocket = app.getSocket();
      mSocket.on(Socket.EVENT_CONNECT,onConnect);
      mSocket.on(Socket.EVENT_DISCONNECT,onDisconnect);
      mSocket.on(Socket.EVENT_CONNECT_ERROR, onConnectError);
      mSocket.on(Socket.EVENT_CONNECT_TIMEOUT, onConnectError);
      mSocket.connect();
   private Emitter.Listener onConnect = new Emitter.Listener() {
      @Override
      public void call(Object... args) {
          runOnUiThread(new Runnable() {
              @Override
              public void run() {
                  if(!isConnected) {
                      if(null!=channelName)
                          mSocket.emit("add channel", channelName, channelDescription);
                      Toast.makeText(getApplicationContext(),
                              "Connected", Toast.LENGTH_LONG).show();
                      isConnected = true;
                  }
              }
          });
      }
  };
  private Emitter.Listener onDisconnect = new Emitter.Listener() {
      @Override
      public void call(Object... args) {
          runOnUiThread(new Runnable() {
              @Override
              public void run() {
  
                  isConnected = false;
                  Toast.makeText(getApplicationContext(),
                          "Disconnected. Please check your internet connection", Toast.LENGTH_LONG).show();
              }
          });
      }
  };
  
  private Emitter.Listener onConnectError = new Emitter.Listener() {
      @Override
      public void call(Object... args) {
          runOnUiThread(new Runnable() {
              @Override
              public void run() {
  
                  Toast.makeText(getApplicationContext(),
                          "Failed to connect", Toast.LENGTH_LONG).show();
              }
          });
      }
  };
  @Override
  public void sendChannel(ArrayList&lt;String&gt; channelList) {
      channelName = channelList.get(0);
      channelDescription = channelList.get(1);
      if (channelName != null &amp;&amp; channelDescription != null) {
          navItemIndex = 0;
          CURRENT_TAG = TAG_CHANNEL;
          Bundle bundle = new Bundle();
          bundle.putString("channelName", channelName);
          bundle.putString("channelDescription", channelDescription);
  
          AddChannelModel addChannelModel = new AddChannelModel(channelName, channelDescription);
          mSocket.emit("newChannel", addChannelModel);
          Toast.makeText(this, "new channel", Toast.LENGTH_SHORT).show();
   }
  }
  @Override
  public void onDestroy() {
      super.onDestroy();
  
      mSocket.disconnect();
  
      mSocket.off(Socket.EVENT_CONNECT, onConnect);
      mSocket.off(Socket.EVENT_DISCONNECT, onDisconnect);
      mSocket.off(Socket.EVENT_CONNECT_ERROR, onConnectError);
      mSocket.off(Socket.EVENT_CONNECT_TIMEOUT, onConnectError);
  }
  }
  </code></pre>
  
  <p><strong>RoundTableApplication.java</strong></p>
  
  <pre><code>public class RoundTableApplication extends Application {
  
  private Socket mSocket;
  {
      try {
          mSocket = IO.socket("http://chattymac.herokuapp.com/v1/");
      } catch (URISyntaxException e) {
          throw new RuntimeException(e);
      }
  }
  
  public Socket getSocket() {
      return mSocket;
  }
  }
  </code></pre>
  
  <p><strong>AlertDialogueBox.java</strong></p>
  
  <pre><code>public class AlertDialogueBox {
  
  EditText etAlertDialogueChannelName, etAlertDialogueChannelDescription;
  private String inputChannelName, inputChannelDescription;
  private final ArrayList&lt;String&gt; channelList = new ArrayList&lt;String&gt;();
  
  private AlertDialogueBoxInterface dialogueBoxInterface;
  private Activity activity;
  
  public AlertDialogueBox(Activity activity){
      this.activity = activity;
      this.dialogueBoxInterface = (AlertDialogueBoxInterface) this.activity;
  }
  
  public boolean getAlertDialogueBox(){
      // inflate alert dialog xml
      LayoutInflater li = LayoutInflater.from(activity);
      View dialogView = li.inflate(R.layout.custom_dialogue_add_channel, null);
      AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
              activity);
      // set title
      //alertDialogBuilder.setTitle("Add Channel");
      // set custom_dialog.xml to alertdialog builder
      alertDialogBuilder.setView(dialogView);
      etAlertDialogueChannelName = (EditText) dialogView
              .findViewById(R.id.custom_dialogue_channel_name);
      etAlertDialogueChannelDescription = (EditText) dialogView
              .findViewById(R.id.custom_dialogue_channel_description);
      // set dialog message
      alertDialogBuilder
              .setCancelable(false)
              .setPositiveButton("Add Channel",
                      new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog,
                                              int id) {
                              inputChannelName = etAlertDialogueChannelName.getText().toString();
                              inputChannelDescription = etAlertDialogueChannelDescription.getText().toString();
                              channelList.add(inputChannelName);
                              channelList.add(inputChannelDescription);
                              dialogueBoxInterface.sendChannel(channelList);
                              //Toast.makeText(activity, channelList.toString(), Toast.LENGTH_SHORT).show();
                              dialog.cancel();
                          }
                      })
              .setNegativeButton("Cancel",
                      new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog,
                                              int id) {
                              dialog.cancel();
                          }
                      });
      // create alert dialog
      AlertDialog alertDialog = alertDialogBuilder.create();
      // show it
      alertDialog.show();
  return true;
  }
  }
  </code></pre>
  
  <p>Github link to my code is - <strong><a href="https://github.com/jadaungeetanjali/RoundTable" rel="nofollow noreferrer">https://github.com/jadaungeetanjali/RoundTable</a></strong></p>
  
  <p>I am new to  android, if anyone could help me out in this. Thanks in advance</p>