Ronnie Ronnie - 1 year ago 104
Android Question

Android MediaController intercepts all other touch events

The top half of my app has a

with a
under it. The bottom half is an image with some buttons. While the
is visible, the buttons below are not clickable. It's like while the
is visible, it intercepts all other touch events, even if they are not within the bounds of the

Any idea around that?

Answer Source

You can check out my answer on overriding dispatchTouchEvent() to pass clicks through MediaController to an underlying Button, but I'm guessing there's something wrong with the way you use MediaController. Can you post your layout?

UPD: Actually, strike that. I've just taken a look at MediaController code and it turns out it creates a new Window for itself. That's why your clicks don't get dispatched — they're dispatched to another window. Also, as far as I can tell from the constructor code, if you inflate the MediaController via xml (i.e. use it in a layout file and then just find it by id from you code) — it won't create the extra Window. That's weird, but I'm sure they had reasons for that.

So, the solution is to either try to use MediaController in a layout file or go with CommonsWare's solution. Please, let me know how it goes in case you give the xml thing a try.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download