Android with node.js server

package com.github.nkzawa.socketio.androidchat;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.github.nkzawa.emitter.Emitter;
import com.github.nkzawa.socketio.client.IO;
import com.github.nkzawa.socketio.client.Socket;

import org.json.JSONException;
import org.json.JSONObject;


public class GameActivity extends ActionBarActivity{

private Socket mSocket;
try {
mSocket = IO.socket(“”);
} catch (URISyntaxException e) {
throw new RuntimeException(e);

protected void onCreate(Bundle savedInstanceState) {
mSocket.emit(“adduser”, “uspmca”);
mSocket.on(“existingUserOnTable”, SetUserInfo);

public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(, menu);
return true;

public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == {
return true;

return super.onOptionsItemSelected(item);

private Emitter.Listener SetUserInfo = new Emitter.Listener() {
public void call(Object… args) {
// JSONObject data = (JSONObject) args[0];

Log.i(“Existing Users”,”Yes Uma”);


Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *