multithreading - Android wear doesn't start thread -



multithreading - Android wear doesn't start thread -

i'm building application team robot auto allow drive controlled mobile device. works on phone, i've ported app android wear, thread lets me connect server on raspberry pi doesn't work. there way thread working?

code:

public class socketconnect { static dataoutputstream dout; static socket socket; public static void connect() { system.out.println("got connect"); new thread() { public void run() { seek { socket = new socket("192.168.2.9", 8899); system.out.println("trying @ 2.9"); dout = new dataoutputstream(socket.getoutputstream()); } grab (ioexception e) { e.printstacktrace(); } } }.start(); } ....further code

logcat error: http://pastebin.com/0btf27p8 (couldn't format nice in editor)

two problems approach:

networkonmainthreadexception - can't network operations on main (ui) thread on android 4.0+ devices android wear devices cannot straight connect any net address - have utilize wearable info layer send info phone app , have connect/pass info server

in many cases, including you'd want controlling robot car, you'd want utilize messages transfer lightweight command watch phone app.

android multithreading sockets android-wear

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -