Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strike>You can check out <a href="https://stackoverflow.com/a/12063783/375929">my answer on overriding <code>dispatchTouchEvent()</code></a> to pass clicks through <code>MediaController</code> to an underlying <code>Button</code>, but I'm guessing there's something wrong with the way you use MediaController. Can you post your layout?</strike></p> <p><strong>UPD:</strong> Actually, strike that. I've just taken a look at <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/widget/MediaController.java#MediaController.initFloatingWindow%28%29" rel="nofollow noreferrer"><code>MediaController</code></a> code and it turns out it creates a new <code>Window</code> 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 <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/widget/MediaController.java#MediaController.%3Cinit%3E%28android.content.Context%2Candroid.util.AttributeSet%29" rel="nofollow noreferrer">constructor code</a>, 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 <code>Window</code>. That's weird, but I'm sure they had reasons for that.</p> <p>So, the solution is to either try to use MediaController in a layout file or go with <a href="https://stackoverflow.com/a/12449001/375929">CommonsWare's solution</a>. Please, let me know how it goes in case you give the xml thing a try.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload