Hey all, thanks for all your help so far!  I have the following
function running on a timer every 20 seconds or so.  However, every
time it runs, my user interface for this program (an EditText box and
a submit Button) freezes until the HttpPost is finished.  Is there a
way for me to run this function "in the background" or something so it
doesn't freeze the interface?  Is there a more efficient way to do
what I'm trying to do here?  The "chatscreen" variable is a TextView.
Thanks for your help!



         public void updateChat() {
                // get chat updates
                HttpClient updateclient = new DefaultHttpClient();
                HttpPost updatepost = new 
HttpPost("https://www.mysite.com/chat.php?
action=updatechat");
        ResponseHandler<String> responseHandler = new
BasicResponseHandler();
        String responseBody;
                try {
                        // send message
                        responseBody = updateclient.execute(updatepost, 
responseHandler);
                        if (responseBody != "")
                        {
                                chatscreen.append(responseBody);
                                chatview.fullScroll(View.FOCUS_DOWN);
                                mytext.setText("");
                                mytext.requestFocus();
                        }
                } catch (ClientProtocolException e) {
                        // error sending message
                        chatscreen.append("There was an error retrieving the 
message.\n");
                } catch (IOException e) {
                        // error sending message
                        chatscreen.append("There was an error retrieving the 
message.\n");
                }
        }

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