as the documentation for TouchGesture says as follows:
Capturing touch events for a single view
As an alternative to onTouchEvent(), you can attach an View.OnTouchListener object to any View object using the setOnTouchListener() method. This makes it possible to to listen for touch events without subclassing an existing View. For example:
View myView = findViewById(R.id.my_view);
myView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
// ... Respond to touch events
return true;
}
});
Beware of creating a listener that returns false for the ACTION_DOWN event. If you do this, the listener will not be called for the subsequent ACTION_MOVE and ACTION_UP string of events. This is because ACTION_DOWN is the starting point for all touch events.
But returning false for the onTouch() method calls subsequent events ACTION_MOVE AND ACTION_UP and returning true is not calling the following events such as ACTION_MOVE AND ACTION_CANCEL. This look counter part from the documentation.
my code :
/**
* Setting Touch Listener to Tabs <br/>
* ReSelecting the tabs calls the touch listener and open the Default/Initial Screen for the tab.
*/
protected void setTabListeners() {
if (mTabHelper.getTabHost() != null) {
final TabWidget tabWidget = mTabHelper.getTabHost().getTabWidget();
int tabsCount = tabWidget.getChildCount();
for (int i = 0; i < tabsCount; i++) {
mLogger.info("count = " + i);
tabWidget.getChildAt(i).setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
mLogger.info("event "+event.getAction());
return false;
}
});
}
}