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
Source: stackoverflow.com
Related Query
- Node.js and Websocket in Android Eclipse
- NoClassDefFoundError - Eclipse and Android
- Eclipse Android and gitignore
- eclipse not showing Avd manager window and android project
- How to use Gradle to generate Eclipse and Intellij project files for Android projects
- Scala, Android and Eclipse
- Android Development Tool 23.0.0 and Android L Update error in eclipse
- Eclipse with android plugin - Blocked at "calculating requirements and dependencies"
- "Selection cannot be launched and there are no recent launches” when Eclipse for Android Project Dev
- Mercurial ignore-file for Eclipse and Android development
- Differences between Android NetBEANS plugin and Eclipse plugin?
- Eclipse and Android SDK issue "aapt.exe has stopped"
- Using JDK 7 Or Higher With Android Studio And Eclipse On Mac OSX
- What are the differences between android studio and the eclipse version bundled with android SDK
- What is the difference between Eclipse "Import" and "Create project from existing source" for Android projects?
- Eclipse and Android XML layouts gives "'default' is not a best match for any device/locale combination"
- Error with parsing Android sdk content and initializing java tooling in eclipse
- Using Android library in eclipse and jumping to class files instead of source file that is within eclipse workspace
- cannot access memory at address 0X1 after setting up gdb and eclipse to debug shared library from Android Application
- Using ADT and SDK manager, attach android source code to eclipse
- Eclipse IDE - Android Graphical Layout and XML Layout Side by Side
- Why does Android Eclipse constantly refresh external folders and take forver?
- How to create new android project in eclipse and share in local git repository?
- Eclipse Indigo Android ADT - install OK, no "Android" option in Preferences and New Project
- Fixing Eclipse errors when using Android NDK and std::vector
- Android trying to run my project in eclipse and end up with xml.out
- RoboLectric and Android in Eclipse (WARNING: no system properties value for ro.build.date.utc)
- How to properly clone an Android project using Eclipse and Mercurial
- Eclipse ADT (Theme and Icon) is broken after updating Android SDK
- Eclipse and Android and classpath: bin and target
More Query from same tag
- Genymotion emulator does not start
- Draw Vertical Label using draw2d in eclipse plugin
- Missing Dependencies in Eclipse IDE with Flink Quickstart
- Eclipse - Debug As window
- How do I run a java class, using Intellij, that needs configuration files from another project/module?
- How to customize hot keys in eclipse?
- Share private key in android development
- java hotspot(tm) 64-bit server vm warning ignoring option permsize=256m support was removed in 8.0
- Saving bitmap in sharedpreferences, Out of memory
- Can't find the buttons to add and remove tag filters in LogCat
- After uploading .apk to market, locally map v2 dont work
- How to correctly style borders of a CTabItem
- Building a jar to be used in an eclipse PDE?
- What are the minimum requirements to run an Eclipse Che server for 1 user?
- Problems with facebook-android-sdk
- How to display different labels for the same action in the a Project Explorer context menu item depending on the nature of the project selected?
- How to explore the Spring context of a Server in DEBUG view
- m2eclipse: automatic Maven install upon build of dependencies
- Different Import Statement Required in Eclipse
- How to emulate "-lib foo.jar" from _within_ build.xml
- The import org.omg cannot be resolved
- android studio: 2 errors: [cannot find symbol variable sharedPref] && [Execution failed for task ':app:compileDebugJavaWithJavac']
- Edit a Jlable by using a variable to call it?
- When I write to the SharedPreferences, there seems to a mix between the stored Strings
- Eclipse WTP - specify deploy folder for the project
- How do I make a file open directly in the app?
- java.util.NoSuchElementException while getting ArrayList from HashMap using Iterator
- eclipse errors when calling methods of imported abstract classes or interfaces from different project
- I have enabled the "Build Automatically" option in eclipse, still it is not generating the class files
- ClassNotFoundException when launching junit tests in Eclipse 2019-12 on Windows when using Java 9+