Hello,
I have created my first app, named "fingerbilliards" on the market.
It is a 3 ball billiards game, and I am trying to improve it.
The problem is; ANR keyDispatchingTimedOut errors. There are very few reports from the market about it, but I do encounter this problem in my own device also.
You hit the balls with your finger, the balls hit each other and the cushions, and some time later they stop. It runs smooth and there is no problem.
After some minutes, you hit the ball, the ball starts to move, and suddenly the phone hangs.
Later a "force close" dialogue appears.
All about the game is processed in the same activity. The speed of the finger to shoot the ball is calculated within touch down-move-up events. No problem about this part I guess.
After the ball is shot, the timer tick event begins. The moves of the balls are calculated and drawn in the timer event. When the speed of all the balls are zero, the timer is disabled.
App Not Responding happens during the timer_tick, when the first ball is on the move.
The interval of the timer is 4 ms since the game loses smoothness at higher intervals.
So, I guess the system cannot handle other calls during timer event.
I tried to put doevents line, but that did not help.
Can you help me with suggestions?
Maybe I can use threading library, but I do not know how to timer sub within threading sub. Or if I make the calculations in a code module, will that prevent the main activity from being freezed?
Thank you
ilker
I have created my first app, named "fingerbilliards" on the market.
It is a 3 ball billiards game, and I am trying to improve it.
The problem is; ANR keyDispatchingTimedOut errors. There are very few reports from the market about it, but I do encounter this problem in my own device also.
You hit the balls with your finger, the balls hit each other and the cushions, and some time later they stop. It runs smooth and there is no problem.
After some minutes, you hit the ball, the ball starts to move, and suddenly the phone hangs.
Later a "force close" dialogue appears.
All about the game is processed in the same activity. The speed of the finger to shoot the ball is calculated within touch down-move-up events. No problem about this part I guess.
After the ball is shot, the timer tick event begins. The moves of the balls are calculated and drawn in the timer event. When the speed of all the balls are zero, the timer is disabled.
App Not Responding happens during the timer_tick, when the first ball is on the move.
The interval of the timer is 4 ms since the game loses smoothness at higher intervals.
So, I guess the system cannot handle other calls during timer event.
I tried to put doevents line, but that did not help.
Can you help me with suggestions?
Maybe I can use threading library, but I do not know how to timer sub within threading sub. Or if I make the calculations in a code module, will that prevent the main activity from being freezed?
Thank you
ilker