Fwd: Problem in Handler

by roshan vidapanakal » Fri, 04 Feb 2011 05:19:29 GMT


Sponsored Links
 lz tell ,me how to handle key dispatch timed out error in android. I have
developed a small quiz application. If i double click my app two times then
it shows *key dispatch timed out error* .
Plz help me if any one knows

---------- Forwarded message ----------
From: yogi <yogi.ru...@gmail.com>
Date: Thu, Feb 3, 2011 at 9:46 AM
Subject: [android-developers] Problem in Handler
To: Android Developers <android-developers@googlegroups.com>


Hi all,
I have created to thread in an application, and from these threads i
am sending a value.
But the App has started but after 5-6 seconds it crashes and with the
following log error.


02-03 09:40:19.598: ERROR/AndroidRuntime(1684): FATAL EXCEPTION: main
02-03 09:40:19.598: ERROR/AndroidRuntime(1684):
android.util.AndroidRuntimeException: { what=1000 when=2469427 obj=4 }
This message is already in use.
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.os.MessageQueue.enqueueMessage(MessageQueue.java:171)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.os.Handler.sendMessageAtTime(Handler.java:457)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.os.Handler.sendMessageDelayed(Handler.java:430)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.os.Handler.sendEmptyMessageDelayed(Handler.java:394)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.os.Handler.sendEmptyMessage(Handler.java:379)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.view.ViewRoot.scheduleTraversals(ViewRoot.java:652)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.view.ViewRoot.requestLayout(ViewRoot.java:596)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.view.View.requestLayout(View.java:8125)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.view.View.requestLayout(View.java:8125)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.view.View.requestLayout(View.java:8125)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.view.View.requestLayout(View.java:8125)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.view.View.requestLayout(View.java:8125)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.widget.TextView.checkForRelayout(TextView.java:5378)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.widget.TextView.setText(TextView.java:2688)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.widget.TextView.setText(TextView.java:2556)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.widget.TextView.setText(TextView.java:2531)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
com.demo.app.handlerapp$3.handleMessage(handlerapp.java:95)
02-03 09:40:19.598: ERROR/AndroidRuntime(1684): at
android.os.Handler.dispatchMessage(Handler.java:99)

Please refer to the following code which i have written.

package com.demo.app;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class handlerapp extends Activity implements OnClickListener{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
s



Other Threads

1. WebView memory leak

I have an activity using an xml layout where a WebView is embedded. I am 
not using the WebView in my activity code at all, all it does is sitting 
there in my xml layout.


Now, when I finish the activity, I find that my activity is not being cleared from memory. (I check via hprof dump). The activity is entirely cleared though if I remove the WebView from the xml layout. I already tried a webView.destroy(); webView = null; in onDestroy() of my activity, but that doesn't help much. In my hprof dump, my activity (named 'Browser') has the following remaining GC roots (after having called destroy() on it): com.myapp.android.activity.browser.Browser - mContext of android.webkit.JWebCoreJavaBridge - sJavaBridge of android.webkit.BrowserFrame [Class] - mContext of android.webkit.PluginManager - mInstance of android.webkit.PluginManager [Class] I found that another developer has experienced similar thing, see the reply of Filipe Abrantes on: http://www.curious-creature.org/2008/12/18/avoid-memory-leaks-on-android/ : "Indeed a very interesting post. Recently I had a very hard time troubleshooting a memory leak on my Android app. In the end it turned out that my xml layout included a WebView component that, even if not used, was preventing the memory from being g-collected after screen rotations/app restartis this a bug of the current implementation, or is there something specific that one needs to do when using WebViews" Now, unfortunately there has been no reply on the blog or the mailing list about this question yet. Therefore I am wondering, is that a bug in the SDK (maybe similar to the MapView bug as reported http://code.google.com/p/android/issues/detail?id=2181) or how to get the activity entirely off the memory with a webview embedded? (I noted a similar thread on the mailing list from last year, but unfortunately never an answer to it;

2. Tanya X10i

Bapak2 ibu, saya yasir , pakai xperia 10i baru baru saja, yang saya alami 
batery boros sekali, pake mode airplane saja pagi full jam 12 siang sdh habis 
separo, pemakaian normal sampai jam3 sdh tdk mampu on lg, kadang klo sering ??? 
 sdh habis sekitar jam 1, apa ada solusi menghemat batre, ato saya salah 
seting, ato memang batre yang saya dpt jelek yah, kan klo memang batrenya ga 
normal bisa saaya klaim ke sony nya..makasih banyak sebelumnya


tuaN yaSiR

-- 
"Indonesian Android Community [id-android]" 

3. ContentValues, strings, and escaping...

4. you tube di spica

5. XML Parsing Strange Error

6. Muncul label inbox dan spam

7. Reading from XML