Hi,

I had a look on the bluetooth example and think it is not correcty
implement either. I ask the community to correct me. The example is
putting each block of bytes read by a single call of read() into a
reperate line in the list view. It relys on that the sending string
can be read at once, which is not correct actually. If the read()
would break up the sending string the view would then add more than
one line for a single chat string. I guess this in done for simplicity
not to blow at the example. If it should be done correctly however one
could take a additional string builder which collects all the bytes
taken from consecutive read()s and search for the delimiter. I did not
check if the bluetooth example is putting something like "\n" at the
and of each string to be send. If not it should be added and the
receiver could search for the "\n" and when found put the string on
the list view, if not just wait for the next read() to come and append
the new bytes to the currently stored string in the string builder
until the "\n" shows up and so on.
This would be the same approach as I recommended by "^... $" in my
post before, assuming a new string is starting excactly after "\n",
let say the pre and post fix is combined in a single "\n".

Hope this helps

spachner

On 23 Apr., 22:43, gomezef <[email protected]> wrote:
> Like for example, in Google's bluetoothchat, they are doing the same
> thing that is the model I am following.  What is the difference?
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to