Ugh.  How is this not totally fixed in 2.0+?  I know it's not as bad
as 1.6- but properly implemented, touch events should have a
negligible impact on performance.

On Mar 21, 10:47 am, Mario Zechner <badlogicga...@gmail.com> wrote:
> I just coded up a simple performance for a project of mine and found
> that the touch event flood problem is back in town albeit with a new
> face. Here's a simple test case which:
>
> <pre lang="Java">
> package com.badlogic.gdx;
>
> import javax.microedition.khronos.egl.EGLConfig;
> import javax.microedition.khronos.opengles.GL10;
>
> import android.app.Activity;
> import android.opengl.GLSurfaceView;
> import android.opengl.GLSurfaceView.Renderer;
> import android.os.Bundle;
> import android.util.Log;
> import android.view.Window;
> import android.view.WindowManager;
>
> public class LagTest extends Activity implements Renderer
> {
>         public void onCreate( Bundle bundle )
>         {
>                 super.onCreate( bundle );
>                 requestWindowFeature(Window.FEATURE_NO_TITLE);
>                 
> getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
> WindowManager.LayoutParams.FLAG_FULLSCREEN );
>                 GLSurfaceView view = new GLSurfaceView( this );
>                 view.setRenderer( this );
>                 setContentView( view );
>         }
>
>         long startTime = 0;
>         int frames;
>
>         @Override
>         public void onDrawFrame(GL10 gl)
>         {
>                 frames++;
>                 if( System.nanoTime() - startTime > 1000000000 )
>                 {
>                         Log.d( "Lag Test", "fps: " + frames );
>                         startTime = System.nanoTime();
>                         frames = 0;
>                 }
>         }
>
>         @Override
>         public void onSurfaceChanged(GL10 gl, int width, int height) {
>                 // TODO Auto-generated method stub
>
>         }
>
>         @Override
>         public void onSurfaceCreated(GL10 gl, EGLConfig config)
>         {
>                 startTime = System.nanoTime();
>                 frames = 0;
>         }}
>
> </pre>
>
> What this does is simply setting up a GLSurfaceView and output the
> frames per second each second. If you watch your LogCat output while
> touching the screen and dragging your finger you'll see the fps
> counter go crazy. On my Droid with Android 2.0.1 it changes between 55
> frames and 59 frames. As soon as i lift the finger it's back to 60
> frames per second. Setting an OnTouchListener and sleeping in the
> onTouch method does not solve the problem. Can anyone confirm this?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to