Note that there are some explanatory texts on larger screens.

plurals
  1. POAfter adding the MediaRouteButton my App crashes
    text
    copied!<p>I have some strange issues:</p> <p>I added the MediaRouteButton in my Layout</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/group_right" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentRight="true" android:orientation="horizontal" &gt; &lt;LinearLayout android:id="@+id/right_btns" android:layout_width="wrap_content" android:layout_height="match_parent" android:minWidth="@dimen/actionbar_icon_width" android:orientation="horizontal" &gt; &lt;/LinearLayout&gt; &lt;android.support.v7.app.MediaRouteButton android:id="@+id/media_route_button" android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>It works really fine on my newer devices. But for older devices with 3.1, 2.3 or lower I'm getting this exception</p> <pre><code>Caused by: android.view.InflateException: Binary XML file line #74: Error inflating class android.support.v7.app.MediaRouteButton at android.view.LayoutInflater.createView(LayoutInflater.java:596) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:671) at android.view.LayoutInflater.rInflate(LayoutInflater.java:724) at android.view.LayoutInflater.rInflate(LayoutInflater.java:727) at android.view.LayoutInflater.inflate(LayoutInflater.java:479) at android.view.LayoutInflater.inflate(LayoutInflater.java:391) at android.view.LayoutInflater.inflate(LayoutInflater.java:347) at de.myapp.views.MyActionBar.&lt;init&gt;(MyActionBar.java:54) ... 36 more Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:416) at android.view.LayoutInflater.createView(LayoutInflater.java:576) ... 43 more Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f01000c a=3} at android.content.res.Resources.loadDrawable(Resources.java:1841) at android.content.res.TypedArray.getDrawable(TypedArray.java:601) at android.view.View.&lt;init&gt;(View.java:2462) at android.support.v7.app.MediaRouteButton.&lt;init&gt;(MediaRouteButton.java:121) at android.support.v7.app.MediaRouteButton.&lt;init&gt;(MediaRouteButton.java:117) ... 46 more </code></pre> <p>In my code it happens when I inflate the xml Layout</p> <pre><code>public MyActionBar(Context context, AttributeSet attrs) { super(context, attrs); inflate(context, R.layout.group_action_bar, this); titleGroup = (ViewGroup) findViewById(R.id.group_title); leftBtnGroup = (ViewGroup) findViewById(R.id.left_btns); rightBtnGroup = (ViewGroup) findViewById(R.id.right_btns); titleAppendix = findViewById(R.id.group_title_appendix); } </code></pre> <p>Does anyone know why this doesn't work for older devices with lower api-level?</p> <p>Thanks!!!</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