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. Shadow on top of a layout on ActivityGroup

Hello everyone,

I'm trying to give my first steps on working with ActivityGroups. To
be more specific, I have a parent activity with a layout containing
several buttons, and another layout below them in order to add other
activities' layouts by means of the "addView()" method. Well,
everything works fine in functionality terms; but I'm experiencing a
weird behavior inside the layout where other activities are kind of
loaded into.
A black line along the top border of the layout plus a slight shadow
do appear when I run the application on the emulator. I have tried to
play changing the paddings, margins, etc. with no success.

Has any of you experienced such weird behavior?

Many thanks in advance!

-- 

2. Return custom objects tre

Hi everyone :)

it's the first message I post in this group, even though I lurked and
posted from time to time in #android-dev.
I have a question about  IPC.

At work we are developing 2 applications:
1 - a service running in background and preparing some data.
2 - an application that takes the data from the service and uses it
for something.

The problem is that service 1) should be able to pass an object like

class CustomObject{

   private AnotherCustomObject aco = new AnotherCustomObject();

   public AnotherCustomObject getObject(){
       return aco;
   }

}

and application 2) should be able to retrieve such object and call the
method getObject()

How do I achieve this? I was thinking of doing like so:
1) create an aidl file for AnotherCustomObject and for CustomObject.
Something like ICustomObject and IAnotherCustomObject.
2) on the service 1) side, make CustomObject implement ICustomObject
and Parcelable and AnotherCustomObject implement IAnotherCustomObject
and Parcelable and write the implementation of the methods.
3) on the application 2) side, import the aidl files and use the
automatically generated interfaces to manipulate the custom objects.

Is this the correct way to do this in your opinion? In point 2) should
I extend the stubs instead?

Thanks in advance for your hints.

Giordano


-- 

3. SMS to Contact

4. Android 2.2 Voice Recognition Sample problem And Speech Recognition with file

5. insert musical unicode

6. CodeSnipr Learning can be simple!!

7. New to Android and programming