score:1

Accepted answer

hy karan.. you are going in the right way mate. the only thing that is missing is the small snippet of code. error here is that you set adapter in working thread. you can update views only from main thread. you have to move the portion of the background task that updates the ui onto the main thread. just replace the code on:

@override
            public void on(string event, ioacknowledge ack, object... args)

with:

@override
            public void on(string event, ioacknowledge ack, object... args) {
                // todo auto-generated method stub
                if(event.equals("new_client_message")){
                    log.v("socketio", "new_client_message" + " " + args[0]);
                    rohan = args[0].tostring();
                    system.out.println("admin" + " : " + " " + rohan);

                    runonuithread(new runnable(){

                        @override
                        public void run() {
                            // todo auto-generated method stub
                            mlistdata.add("admin" + " : " + " " + rohan);
                            mlistdata.notifydatasetchanged();
                            lvlist.setselection(mlistdata.getcount() -1);

                        }

                    });
                }

here "new_client_message" is trigger from the server.. just replace with yours. for example in you case "new_message" is the trigger from your app to the server. sorry for not a professional word but i hope it will help. cheers


Related Query

More Query from same tag