skkap
skkap

Reputation: 348

onTouchEvent in TabActivity don't react on anything

I have TabActivity:

public class timetable extends TabActivity  
{
...
    @Override
    public boolean onTouchEvent(MotionEvent event) 
    {
        Toast.makeText(this, "!", Toast.LENGTH_SHORT).show();  
        return true;
    }
...
}

but anything not happend when I move my finger on screen (push, fling, ..) Help me!

Upvotes: 0

Views: 823

Answers (1)

Peter Knego
Peter Knego

Reputation: 80340

Instead of

Toast.makeText(this, "!", Toast.LENGTH_SHORT).show();

put in

android.util.Log("TabActivity", "motion event type="+(event.getAction() & MotionEvent. ACTION_MASK)

Then you should see various events for touch down (0), move (2) and touch up (1). Take a look at Android log to see events (filter on TabActivity).

Edited:

I was not paying attention. TabActivity contains child Views which consume touch events. You should place your code inside child Views.

Upvotes: 1

Related Questions