How do I detect touch input on the Android

Try code below to detect touch events.

mView.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        //show dialog here
        return false;
    }
});

To show dialog use Activity method showDialog(int). You have to implement onCreateDialog(). See documentation for details.

Leave a Comment