in my app the user_A can send message to the user_B, when the user_A send message to user_B then user_B will return value (status) that the message sent has been received. user_B return status to user_A use asyntask and work very well, but I get problems when user_A send many messages repeatedly and quickly, automatically my asyntask called repeatedly and I get warning "MessageQueue"
12-31 14:09:33.664: W/MessageQueue(3264): Handler (android.location.LocationManager$ListenerTransport$1) {41403330} sending message to a Handler on a dead thread
12-31 14:09:33.664: W/MessageQueue(3264): java.lang.RuntimeException: Handler (android.location.LocationManager$ListenerTransport$1) {41403330} sending message to a Handler on a dead thread
12-31 14:09:33.664: W/MessageQueue(3264): at android.os.MessageQueue.enqueueMessage(MessageQueue.java:196)
12-31 14:09:33.664: W/MessageQueue(3264): at android.os.Handler.sendMessageAtTime(Handler.java:473)
12-31 14:09:33.664: W/MessageQueue(3264): at android.os.Handler.sendMessageDelayed(Handler.java:446)
12-31 14:09:33.664: W/MessageQueue(3264): at android.os.Handler.sendMessage(Handler.java:383)
here my Code
private class messageReceived extends AsyncTask<Void, Void, String> {
private String val;
public messageReceived() {
}
@Override
protected String doInBackground(Void... unsued) {
HttpClient client = new DefaultHttpClient();
HttpResponse response;
HttpPost post = new HttpPost("http://myUrl.com/updateSts.php");
List<NameValuePair> nVP = new ArrayList<NameValuePair>(2);
nVP.add(new BasicNameValuePair("msg_id", "023921"));
post.setEntity(new UrlEncodedFormEntity(nVP));
response = client.execute(post);
val= org.apache.http.util.EntityUtils.toString(response.getEntity());
return val;
}
@Override
protected void onPostExecute(String val) {
Log.d(TAG,"posExecuteClass=>"+val);
}
}
how do I solve this problem ? there may be other ways besides this,. thanks