9

I am getting Application Not Responding (ANR) dialog while continuous tapping on the screen. There is no view on the screen where i am tapping. Frequency of this issue is less but still i am not able to remove it completely.

Here i am attaching the log what i caught during this error.

ERROR/ActivityManager(1322): ANR in com.test.mj.and.ui     (com.test.mj.and.ui/.TermsAndCondActivity)
ERROR/ActivityManager(1322): Reason: keyDispatchingTimedOut
ERROR/ActivityManager(1322): Parent: com.test.mj.and.ui/.SplashActivity
ERROR/ActivityManager(1322): Load: 6.59 / 6.37 / 5.21
ERROR/ActivityManager(1322): CPU usage from 11430ms to 2196ms ago:
ERROR/ActivityManager(1322):   rtal.mj.and.ui: 9% = 7% user + 1% kernel / faults: 649  minor
ERROR/ActivityManager(1322):   system_server: 4% = 2% user + 2% kernel / faults: 10 minor
ERROR/ActivityManager(1322):   logcat: 3% = 1% user + 1% kernel / faults: 675 minor 1  major
ERROR/ActivityManager(1322):   synaptics_wq: 1% = 0% user + 1% kernel
ERROR/ActivityManager(1322):   ami304d: 1% = 0% user + 0% kernel
ERROR/ActivityManager(1322):   .process.lghome: 1% = 0% user + 0% kernel / faults: 47 minor
ERROR/ActivityManager(1322):   sync_supers: 0% = 0% user + 0% kernel
ERROR/ActivityManager(1322):   droid.DunServer: 0% = 0% user + 0% kernel / faults: 6 minor
ERROR/ActivityManager(1322):   events/0: 0% = 0% user + 0% kernel
ERROR/ActivityManager(1322):   oid.inputmethod: 0% = 0% user + 0% kernel / faults: 2 minor
ERROR/ActivityManager(1322):   m.android.phone: 0% = 0% user + 0% kernel / faults: 2 minor
ERROR/ActivityManager(1322):   ndroid.settings: 0% = 0% user + 0% kernel
ERROR/ActivityManager(1322):   sh: 0% = 0% user + 0% kernel / faults: 110 minor
ERROR/ActivityManager(1322):  -flush-179:0: 0% = 0% user + 0% kernel
ERROR/ActivityManager(1322): TOTAL: 19% = 13% user + 6% kernel
WARN/WindowManager(1322): Continuing to wait for key to be dispatched
WARN/WindowManager(1322): No window to dispatch pointer action 1

Can anyone please help me to solve this issue?

Thanks in advance.

Ahsan
  • 2,964
  • 11
  • 53
  • 96
user519846
  • 999
  • 7
  • 15
  • 26
  • What is the application doing when ANR occurs? These are mostly caused by doing something lengthy on the ui thread. – Phobos Dec 25 '10 at 11:20
  • check this http://stackoverflow.com/questions/3467205/android-key-dispatching-timed-out/27292747#27292747 – Zar E Ahmer Dec 04 '14 at 11:21

4 Answers4

3

It usually happens in onClick handler doing some time consuming activity like getting resource from network or computing something complex. Use separate thread for that (UI thread) so that onclick handler can return and Window manager will continue.

http://developer.android.com/resources/articles/painless-threading.html

you can use Asynctask or postDelayed on view

Dileep
  • 775
  • 5
  • 20
1

As stated in this answer before: That happens if a click, touch, key, etc. event is blocking the UI thread.

Funny enough, the same thing happened to me and it was also (very) infrequent. My problem was a binary search based on float values (not intended and very stupid ;-). Sometimes the search criteria doesn't change anymore so I got an infinite loop.

My suggestion: if you never intended to do heavy work which might block the UI thread, try to search for a possible infinite loop in your code.

Community
  • 1
  • 1
Knickedi
  • 8,742
  • 3
  • 43
  • 45
0

If you are doing a resource intensive task then it might happen. While resuming the Activity.

  • Try stopping all your intensive work on onPause and then restarting it on onResume. If you are showing map on Activity drawing overlay on it then stop refreshing the overlays while on sleep and and refresh it on onResume. Use Threads for intensive tasks.

Rajesh Narwal
  • 898
  • 8
  • 8
0

There is limitation of 100kb data to pass from one activity to another. If it exeed the limit, the stated error comes.

Here's http://demetrimiller.com/2010/11/09/android-binder-transaction-failed-error-message/

I got the same error when I passed a huge arraylist. This arraylist, I was, getting it from the server. So try this. May be it solves your problem.

Ruchi
  • 411
  • 4
  • 13