/**
   * Attempts to sign in the account specified by the login form. If there are form errors (invalid
   * username, missing fields, etc.), the errors are presented and no actual login attempt is made.
   */
  private void attemptLogin() throws RemoteException {
    // Reset errors.
    mUsernameView.setError(null);

    // Store values at the time of the login attempt.
    String username = mUsernameView.getText().toString().trim();

    // Check for a valid username.
    if (TextUtils.isEmpty(username)) {
      // There was an error; don't attempt login and focus the first
      // form field with an error.
      mUsernameView.setError(getString(R.string.error_field_required));
      mUsernameView.requestFocus();
      return;
    }

    mUsername = username;
    PreferenceStorage.storeUsername(username);
    // perform the user login attempt.
    ArrayList<String> stringArrayList = new ArrayList<String>();
    stringArrayList.add(username);
    // AppSocketListener.getInstance().emit("add user",stringArrayList,null);
    AppSocketListener.getInstance().addOnHandler(SocketEventConstants.login, onLogin);
    AppSocketListener.getInstance().addNewMessageHandler();
    AppSocketListener.getInstance().emit(SocketEventConstants.addUser, username);
  }
 public void destroySocketListener() {
   AppSocketListener.getInstance().destroy();
 }
 public void initializeSocket() {
   AppSocketListener.getInstance().initialize();
 }