私はAndroidが初めてです。実際、Android画面(レイアウト)をToast
ダブルクリックするたびに、.しかし、画面をダブルクリックしても何も起こりません。私の問題を解決してください。
public class MainActivity extends Activity implements OnDoubleTapListener,OnGestureListener{
int clickCount = 0;
long startTime;
long duration;
static final int MAX_DURATION = 500;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GestureDetector detector = new GestureDetector(this,this);
detector.setOnDoubleTapListener(new OnDoubleTapListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
if(e.getAction()==1)
{
Toast.makeText(getBaseContext(), "onSingleTapConfirmed", Toast.LENGTH_LONG).show();
}
return true;
}
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
if(e.getAction()==1)
{
Toast.makeText(getBaseContext(), "onDoubleTapEvent", Toast.LENGTH_LONG).show();
}
return true;
}
@Override
public boolean onDoubleTap(MotionEvent e) {
if(e.getAction()==1)
{
Toast.makeText(getBaseContext(), "onDoubleTap", Toast.LENGTH_LONG).show();
}
return true;
}
});
}