/** Logout the user from the chat session */
  public void logout() {

    // Set the login to false
    session.setLogin(false);

    // Delete the user
    myHandler.deleteUsers();

    // Disconnect the connection
    clientConnection.disconnect();

    Intent intent = new Intent(ChatRoomActivity.this, LoginActivity.class);
    startActivity(intent);
    finish();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chatroom);

    mySendButton = (Button) findViewById(R.id.mySendButton);

    // Initialize helper objects
    myHandler = new SQLiteHandler(this);
    session = new SessionManager(this);

    // Initialize the message box
    myChatText = (EditText) findViewById(R.id.myChatText);

    // Initialize text view
    myClientCountText = (TextView) findViewById(R.id.myClientCountText);
    myClientCountText.setText("Current people in room: 0");

    // Get the local database data
    myUser = myHandler.getUser();

    // Chat messages
    messageList = new ArrayList<Message>();
    messageAdapter = new MessageAdapter(this, messageList);
    myMessageListView = (ListView) findViewById(R.id.myMessageListView);
    myMessageListView.setAdapter(messageAdapter);

    // Set listener for the send button
    mySendButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            String chatMessage = myChatText.getText().toString();
            clientConnection.getClientMessage(chatMessage);
            myChatText.setText("");
          }
        });

    // Initialize the server connection runnable class, and enter the name of the client
    clientConnection = new ClientConnectThread(myUser.get("name").toString());

    // Starts the connection thread
    Thread connectionThread = new Thread(clientConnection);
    connectionThread.start();
  } // End of onCreate method