java - How to send data from one activity to another. (Bluetooth) -
i'm creating small bluetooth messenger app. have 2 activities main activity , messenger activity. main activity have background threads creating bluetooth socket , managing connection. when socket created starts messenger activity on both devices. messenger activity have edit box, list view , button. question how can send string has been taken edit box write() function in main activity.
public void write(byte[] out) { connectedthread cthread = new connectedthread(bluesocket); cthread.write(out); }
when device gets message sends buffer handler.
buffer = new byte[1024]; bytes = mminstream.read(buffer); // send obtained bytes ui activity mhandler.obtainmessage(message_read, bytes, -1, buffer) .sendtotarget();
handler takes string buffer. , here question: how send string messenger activity add list view.
i not sure if understood - hope helps:
maybe should bluetooth-socket-stuff in service can start , messenger activity (read http://developer.android.com/reference/android/app/service.html ;-) )
Comments
Post a Comment