Get json data on android client listener

  • Thread starter Thread starter AC Question
  • Start date Start date
A

AC Question

I have code socket io js like this

socket.on('clienstconnected',function(data){

var roomlist={id:'1',roomname:'room1',id:'2',roomname:'room2',id:'3',roomname:'room3'};

socket.emit("clienstconnected",roomlist);

});

and Android code like this

private Emitter.Listener onClienstConnected1 = new Emitter.Listener() {
@override
public void call(Object... args) {
JSONObject data = (JSONObject) args[0];

try{


System.out.println(args[0].toString());
}

catch (Exception e) { Log.e("My App", "Could not parse malformed JSON: \"" + data + "\"");}

}
};

and System.out.println print only one item is : id:'3',roomname:'room3' not all Json item as I want
 
Your best bet is to create an account and ask your question in the developers forum.
 

Trending Posts

Members online

Forum statistics

Threads
960,197
Messages
6,981,442
Members
3,164,424
Latest member
Arwen