Specific ontouch slow down question

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Specific ontouch slow down question

Postby SanderS » Sat Nov 28, 2009 2:53 pm

Hello,

Well, probably as a lot of developers I came across the problem that my fps drops when you move your finger on the screen. This is cause by the overflow of data the ontouch event has to process.

To solve this I had some help of Robert Green by using input pipelines: Robert Green

But I still have the problem that within my game, an air hockey game, the push object is moving slower than the finger moves on the screen.

The games has been build as follow:
- an activity which gets the ontouchevents, starts the threas and sets the surfaceview
- the thread does all the calculations (processes all the ontouch events which are received through the pipeline) and draws on the surfaceview
- the surfaceview clears the background and draws the background

When the activity receives an ontouchevent it goed to sleep for 16 miliseconds so the thread has enough time to process everything.

My guess is that when the activity goed to sleep, the surfaceview also goed to sleep since it has been set by the activity. That will also cause the thread to sleep since it cannot update the surfaceview anymore and has to wait before it can update the surfaceview again.

Is this what causes the problem? And how can it be solved? Because the activity always has to set the surfaceview and the thread has to update the surfaceview...

An example youtube video of the game where you can see the slowdown of the push:
Air Hockey

Kind regards,

Themuzz
SanderS
Freshman
Freshman
 
Posts: 6
Joined: Tue Oct 20, 2009 8:23 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests