> Your code snippet is useful, but since it is a part of a larger project,
> some of my comments may be completely wrong. So, your patience is requested.
>
> 1. Do I understand your flow correctly -- you are sending an HTTP POST
> after *every keystroke*? After all, onKeyUp() will get called after
> every key event handled by this View. That is absolutely going to be slow.
>
> 2. Similarly, it would appear you are forking athreadafter every
> keystroke, which seems aggressive. How about a singlebackgroundthread,
> using a LinkedBlockingQueue or something for communications? When an
> event occurs in the UIthreadthat thebackgroundthreadshould process,
> the UIthreadposts an event on the queue. Thebackgroundthreadblocks
> on the queue and handles events as they arise.
>
> 3. Even if you feel that having onebackgroundthreadper keystroke is
> valid, I am not sure you want to join with thebackgroundthread. That
> ties up the UIthreaduntil thebackgroundthreadis done, which is not
> what you want.

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?)

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?

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.
--~--~---------~--~----~------------~-------~--~----~
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