OnTouchEvent に不満を感じています。5本の指だけを検出したいのですが、どうすればそれを達成できますか? また、問題は、複数回呼び出すことです。これが私のコードです:
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
int pointerCount = event.getPointerCount();
System.out.println("My pointer....." + pointerCount);
final int action = event.getAction();
if(action == MotionEvent.ACTION_UP) {
if(pointerCount >= 4){
Log.d("MyActivity", "in onTouchEvent!");
Toast.makeText(MyclassActivity.this, "Finger !!"+pointerCount,Toast.LENGTH_SHORT).show();
Intent z = new Intent(MyclassActivity.this,
DashboardActivity.class);
startActivity(z);
finish();
}
}
return super.onTouchEvent(event);
}
私はこのことに満足していません。正確な 5 本の指を取得してカウントし、onTouchevent の複数回の呼び出しを避けるために、あなたの助けを借りてください。
ありがとう、