My app uses a viewflipper to swith between a standard SurfaceView
and a GLSurfaceView. It works like it should on my Samsung Galaxy S
device.
The problem is that onTouch() in the activity class gets called 2
times for
every touch. This does not occur on my mobile device, but since it
happens on the emulator,
I suspect that this will happen on other devices. What could be the
reason that
onTouch gets called 2 times for every touch in the emulator? This is
some of my code:
--------------
activity onCreate():
setContentView(R.layout.lunar_layout);
mLunarView = (LunarView) findViewById(R.id.lunar);
mLunarView.setAE(this);
mLunarView.setOnKeyListener(this);
mLunarView.setOnTouchListener(this);
vf=(ViewFlipper) findViewById(R.id.flip);
glSurfaceView = (GLSurfaceView) findViewById(R.id.glview);
glSurfaceView.setOnTouchListener(this);
glSurfaceView.setRenderer(lm);
---------------------
activity onTouch():
public boolean onTouch(View v, MotionEvent event) {
{
int x = (int) event.getX();
int y = (int) event.getY();
if(v instanceof LunarView)
((LunarView) v).viewTouched(x, y);
else
{
glSurfaceView.onPause();
mLunarView.getThread().setRunning(true);
vf.setDisplayedChild(0);
mLunarView.getThread().resume();
}
}
return false;
}
-----------------------------
view viewTouched():
if (currentTVisual != null) {
getThread().setRunning(false);
getThread().suspend();
AstralEffects.glSurfaceView.onResume();
AstralEffects.vf.setDisplayedChild(choosenEffect+1);
--
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