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. Is MapController's zoomToSpan() execution deferred?

My application has a MapView which shows a collection of items in a
satellite view.  I use the MapController's zoomToSpan() method to
initialize the zoom level of MapView.  I later discovered that the
MapView was showing a blank white screen with grey X's (zoom'd too
far, zoom out once and everything looks as expected) for the use case
when the collection of item's locations were very close to each
other.  So, I modified the code from this:

mapController.zoomToSpan(latitudeDelta, longitudeDelta);

to this:

mapController.zoomToSpan(latitudeDelta, longitudeDelta);

if (mapView.getZoomLevel() > mapView.getMaxZoomLevel()) {
        mapController.setZoom(mapView.getMaxZoomLevel());
}

but, I still got the same result.  I added some debug before and after
the zoomToSpan() to retrieve the zoom level from MapView and noticed
that the zoom level did not change.  I'm guessing somehow that the
work is queued up??

I don't know if this information is important or not to this problem,
but I'll also mention that the MapView is created from a MapActivity
which is hosted in the tab host of a TabActivity that contains three
tabs, one of which is the map.  I searched this forum and elsewhere
and haven't seen anyone encounter such a problem before.  I'm hoping
someone can point me in the right direction.

-- 

2. Goodbye friends and thanks for all the help.

After yesterdays little farce,

http://ausdroid.net/2010/09/01/google-now-supporting-paid-applications-for-aussie-developers/

and the total lack of care factor re: Google and developers in
countries unable to set up merchant accounts...

I've decided to shelve all my consumer Android projects and go back to
other platforms. Unfortunately, not all apps are suitable for all
revenue models. :(

and beer still needs real money.

When things change I will be back, as I still believe Android has a
fantastic potential that is only just beginning to be realised.

Just wanted to say thanks to everyone here for the help and the
general good feeling that exists in this forum.

Best Regards,

Geoff

-- 

3. Porting Android 2.0 on Samsung 360 M1

4. Memory problem with UI elements

5. Launch Local Drawable Resource in the Gallery app Using Intents

6. does the USB Tethering implement by usbnet?

7. Android file system security