further tests have proved my guess. it is because the event queue
flooding.

after changing my event handling function to this, i have solved this
problem:  basically i let the ui thread sleep a little while after
seeing the touch down event, to make sure the render see that event.

however, i'm not sure how long it should sleep. i have tried 32, but
it didn't work. and now 100 works.

i'm guessing this sleep time should be enough for your render to
finish rendering one frame.

so if my FPS is 60, then i should sleep for 1/60 sec.



public boolean onTouchEvent(final MotionEvent event) {



        Log.d("surfaceview Action:",event.getAction()+";");



        if(event.getAction()==0)

        {







            try {

                queueEvent(new Runnable() {

                    public void run() {

                    //    renderer.debugevent(event.getAction());

                    renderer.onTouchEvent(event);

                    }

                });

                Thread.sleep(100);

            } catch (InterruptedException e) {

                // TODO Auto-generated catch block

                e.printStackTrace();

            }

        }

        else

        {



        queueEvent(new Runnable() {

            public void run() {

                //renderer.debugevent(event.getAction());

            renderer.onTouchEvent(event);

            }

        });}

        return true;

    }

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to