How to create server and client socket on a single different thread
I am working on Android GPS library. I need to create a separate thread in the library that keeps ru开发者_StackOverflownning continuously after creating client and server sockets.
Similarly I create sockets in the Java application that sends values to the library code on user interaction.
How do I create such socket in GPS library and in the application so that they keep running continuously? Basically I want the socket in GPS library in different thread so that it never stops.
Eagerly waiting for your replies....
get a look into services, especially remote services, they run on separate thread each one.
also if you need to run a special code on other thread inside your main app use the new Runnable(), it runs the same code you put into there but within a separate thread.
精彩评论