I am just a couple of days in to programming with Android, and are facing problems with the touch events.
I am unable to detect the finger down and finger up events, the only event that seems to be triggered is a finger down, move followed by finger up, but all I am looking for is a click or finger down / finger up event.
public boolean onTouchEvent(MotionEvent event) {
int eva = event.getAction();
switch (eva) {
case MotionEvent.ACTION_DOWN:
break;
case MotionEvent.ACTION_MOVE:
break;
case MotionEvent.ACTION_UP:
break;
}
Toast.makeText(getApplicationContext(),"Event", Toast.LENGTH_SHORT).show();
return true;
}
in Javascript, this would simply be a click event, but it appears that it's not so easy with this ?
Edit
I should have mentioned that the view is a WebView and not a button, I am trying to capture a single tap anywhere on the screen:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView
android:id="@+id/web_engine"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</RelativeLayout>