Bobbie wrote:
> Here are my replies, next to the number I am answering for your post:
> 
> 1) Yes, after every keystroke, I can change that if need be to update
> on a timer instead (would that be a better way to do it?)

Most chat applications wait until <Enter>, or a button click, or
something to indicate "please send this".

Your HTTP POST will take longer than the keystroke, in all likelihood.
And for every 1K of chatting, you'll be transmitting perhaps 100K of
HTTP POST overhead, which will eat into the user's bandwidth allotment
and won't help the battery any.

If you really think it is worthwhile to send each keystroke over the
Internet as it is typed, HTTP is not the protocol to use. Find something
that will let you keep an open socket and send each keystroke with
little-to-no overhead.

> 2) I'm still new to Android, sorry.  Can you post an example of how I
> should implement this?  Never used LinkedBlockingQueue, but it sounds
> like it would resolve my issue of sending the http post requests in
> order, yes?

This is a Java thing, not an Android thing. LinkedBlockingQueue is in
java.util.concurrent and has been in use in Java applications for a few
years. Here's a blog post covering the notion of BlockingQueues in Java:

http://www.javalobby.org/java/forums/t16278.html

> 3) My intent wasn't to create a thread for each key, I just needed to
> make sure the keystrokes were posted in order, so I thought this was
> the best way to do it.

That would imply each thread gets scheduled and processed in sequential
order, which is not guaranteed.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com

Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml

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

Reply via email to