Unable to convert instance of type 'Android.Support.V7.Widget.CardView' to type button

hello I am working on a Android app that uses the CardView when I go to run the app on a device on startup it crashes and I get this in the output:

Unable to convert instance of type 'Android.Support.V7.Widget.CardView' to type 'android/widget/Button'

I have the cardview package installed so I don't know what i'm doing wrong

here's the code to the layout in question:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/whole"
    tools:context="${relativePackage}.${activityClass}">
    <LinearLayout
        android:layout_width="wrap_content"
        android:id="@+id/scroll"
        android:layout_height="wrap_content">
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <android.support.v7.widget.CardView
                android:id="@+id/one"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp"
                android:layout_marginTop="8dp"
                card_view:cardBackgroundColor="@color/cardsbg"
                card_view:cardElevation="3dp"
                android:clickable="false">
                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
                    <android.support.v7.widget.CardView
                        android:id="@+id/tipsbttn"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="4dp"
                        android:layout_marginRight="8dp"
                        android:layout_marginLeft="8dp"
                        android:layout_marginTop="8dp"
                        android:foreground="?android:attr/selectableItemBackground"
                        card_view:cardBackgroundColor="@color/white"
                        card_view:cardElevation="3dp"
                        android:clickable="true"
                        android:onClick="Tips">
                        <RelativeLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent">
                            <ImageView
                                android:id="@+id/tipicon"
                                android:layout_width="68dp"
                                android:layout_height="68dp"
                                android:layout_centerVertical="true"
                                android:padding="5dp" />
                            <TextView
                                android:id="@+id/web"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_centerVertical="true"
                                android:layout_toRightOf="@id/tipicon"
                                android:text="Plan and Prepare"
                                android:paddingLeft="8dp"
                                android:textColor="@color/cardText"
                                android:textSize="20sp" />
                        </RelativeLayout>
                    </android.support.v7.widget.CardView>
                    <android.support.v7.widget.CardView
                        android:id="@+id/contactbttn"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:foreground="?android:attr/selectableItemBackground"
                        android:layout_marginBottom="4dp"
                        android:layout_marginRight="8dp"
                        android:layout_marginLeft="8dp"
                        android:layout_marginTop="4dp"
                        android:layout_below="@+id/tipsbttn"
                        card_view:cardBackgroundColor="@color/white"
                        card_view:cardElevation="3dp"
                        android:clickable="true">
                        <RelativeLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent">
                            <ImageView
                                android:id="@+id/contacticon"
                                android:layout_width="68dp"
                                android:layout_height="68dp"
                                android:layout_centerVertical="true"
                                android:padding="5dp" />
                            <TextView
                                android:id="@+id/email"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:paddingLeft="8dp"
                                android:layout_centerVertical="true"
                                android:layout_toRightOf="@id/contacticon"
                                android:text="Contact Local Agency"
                                android:textColor="@color/cardText"
                                android:textSize="20sp" />
                        </RelativeLayout>
                    </android.support.v7.widget.CardView>
                    <android.support.v7.widget.CardView
                        android:id="@+id/roadbttn"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:foreground="?android:attr/selectableItemBackground"
                        android:layout_marginBottom="4dp"
                        android:layout_marginRight="8dp"
                        android:layout_marginLeft="8dp"
                        android:layout_marginTop="4dp"
                        android:layout_below="@+id/contactbttn"
                        card_view:cardBackgroundColor="@color/white"
                        card_view:cardElevation="3dp"
                        android:clickable="true"
                        android:onClick="modot">
                        <RelativeLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent">
                            <ImageView
                                android:id="@+id/musicicon"
                                android:layout_width="68dp"
                                android:layout_height="68dp"
                                android:layout_centerVertical="true"
                                android:padding="5dp" />
                            <TextView
                                android:id="@+id/music"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_centerVertical="true"
                                android:layout_toRightOf="@id/musicicon"
                                android:text="MODOT Road Closings"
                                android:paddingLeft="8dp"
                                android:textColor="@color/cardText"
                                android:textSize="20sp" />
                        </RelativeLayout>
                    </android.support.v7.widget.CardView>
                    <android.support.v7.widget.CardView
                        android:id="@+id/wether"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:foreground="?android:attr/selectableItemBackground"
                        android:layout_marginBottom="8dp"
                        android:layout_marginRight="8dp"
                        android:layout_marginLeft="8dp"
                        android:layout_marginTop="4dp"
                        android:layout_below="@+id/roadbttn"
                        card_view:cardBackgroundColor="@color/white"
                        card_view:cardElevation="3dp"
                        android:clickable="true"
                        android:onClick="wether">
                        <RelativeLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent">
                            <ImageView
                                android:id="@+id/playicon"
                                android:layout_width="68dp"
                                android:layout_height="68dp"
                                android:layout_centerVertical="true"
                                android:padding="8dp" />
                        <!--android:src="@drawable/tstorm"-->
                            <TextView
                                android:id="@+id/play"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_centerVertical="true"
                                android:paddingLeft="8dp"
                                android:layout_toRightOf="@+id/playicon"
                                android:text="Weather Radar"
                                android:textColor="@color/cardText"
                                android:textSize="20sp" />
                        </RelativeLayout>
                    </android.support.v7.widget.CardView>
                    <RelativeLayout
                        android:id="@+id/bttom"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/wether"
                        android:paddingTop="8dp"
                        android:layout_marginBottom="8dp">
                        <Button
                            android:id="@+id/button_2"
                            android:onClick="email"
                            android:foreground="?android:attr/selectableItemBackground"
                            android:layout_alignParentLeft="true"
                            android:layout_marginLeft="50dp"
                            android:layout_width="50dp"
                            android:layout_height="50dp" />
                    <!--android:background="@drawable/email"-->
                        <Button
                            android:id="@+id/button_1"
                            android:onClick="settings"
                            android:foreground="?android:attr/selectableItemBackground"
                            android:layout_alignParentRight="true"
                            android:layout_marginRight="50dp"
                            android:layout_width="50dp"
                            android:layout_height="50dp"
                            android:background="@drawable/ic_settings" />
                    </RelativeLayout>
                </RelativeLayout>
            </android.support.v7.widget.CardView>
        </ScrollView>
    </LinearLayout>
    <Button
        android:layout_width="72dp"
        android:layout_height="72dp"
        android:id="@+id/button_4"
        android:onClick="call"
        android:layout_marginTop="-42dp"
        android:layout_below="@+id/scroll"
        android:foreground="?android:attr/selectableItemBackground"
        android:clipToPadding="false"
        android:layout_centerHorizontal="true"
        android:background="@drawable/ic_phone_fab" />
</RelativeLayout>

I will also attach the full output to this question

any help would be amazing!

Thanks in advance

Answers

Sign In or Register to comment.