views:

23

answers:

0

I have a few questions about creating a socket client for android devices.

1) what is the best object/method to use to handle the socket.getInputStream() method. I've seen a few different ideas and before I start playing around with them, I'd like to hear it here first as to what you all think the best approach to handling the InputStream is.

2) do I need to create this application multithreaded? I'm assuming so, so that I can keep a while loop running to listen for new streams coming in while doing other things in my application. If the answer here is yes, can anyone point me to some good resources for creating a multithreaded app for android devices. If the answer here is no, can someone please tell me how I can avoid having to break out of my while loop to manipulate the application according to data that is passed down through the stream.

Essentially I will have the server pass full lines of text down (separated by \n) with instructions to the client to tell it what to do. Example: +++++ChangeScreen or ***PlaySound::Beep. I need the client to derive the entire character string (thinking possibly StringBuilder here) then respond to the instructions accordingly.

If anyone can point me in the right direction I'd greatly appreciate it.

TIA