Implement in your activity:
<pre class="prettyprint prettyprint" id="code_pre" name="code" style="background-color: white; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(204, 204, 204); color: #333333; font-family: monospace, sans-serif; font-size: 13px; font: inherit; line-height: 16px; margin-bottom: 8px; overflow: auto; padding: 8px; vertical-align: baseline; word-wrap: break-word;">public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
switch (eventaction) {
case MotionEvent.ACTION_DOWN:
// finger touches the screen
break;
case MotionEvent.ACTION_MOVE:
// finger moves on the screen
break;
case MotionEvent.ACTION_UP:
// finger leaves the screen
break;
}
// tell the system that we handled the event and no further processing is required
return true; }</pre>Source
read