I've added the android-support-v7-appcompat,android-support-v7-mediarouter library project to build path.
following are my main activity and no errors for import the button, but when execute the app, error inflating MediaRouteButton happens. Thanks a lot for any advice!
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<android.support.v7.app.MediaRouteButton
android:id="@+id/castbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
>
</android.support.v7.app.MediaRouteButton>'
...
public class MainActivity extends android.support.v4.app.FragmentActivity
implements OnClickListener {
private android.support.v7.app.MediaRouteButton castbutton;
First of all you should replace this
With
Update: You must
appcompat referecning
first. To add appcompat library into your Follow the stepsRight Click Project--> go to properties--> android ---> ib tab
to add the appcompat project.