java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.dysaniazzz.testdemo/com.example.dysaniazzz.testdemo.MainActivity}: java.lang.ClassCastException: android.support.v7.widget.AppCompatTextView cannot be cast to android.widget.Button

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Stack Overflow by MostafaUTD
, 1 year ago
Unable to start activity ComponentInfo{com.example.dysaniazzz.testdemo/com.example.dysaniazzz.testdemo.MainActivity}: java.lang.ClassCastException: android.support.v7.widget.AppCompatTextView cannot be cast to android.widget.Button
via Stack Overflow by shashank
, 2 years ago
Unable to start activity ComponentInfo{com.shashank.sharjahinternationalairport/com.shashank.sharjahinternationalairport.MainActivity}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
via GitHub by maxime-kouemo
, 2 years ago
Unable to start activity ComponentInfo{com.example.max_poly.driverecord/com.example.max_poly.driverecord.MenuActivity}: java.lang.ClassCastException: mehdi.sakout.fancybuttons.FancyButton cannot be cast to android.widget.Button
via Stack Overflow by THE ANDROID
, 2 years ago
Unable to start activity ComponentInfo{com.searchingapp.android/com.searchingapp.android.MainActivity}: java.lang.ClassCastException: android.widget.EditText cannot be cast to android.widget.Button
via Stack Overflow by mhyuk
, 3 months ago
Unable to start activity ComponentInfo{com.mhyuktown.exowallpaper/com.mhyuktown.exowallpaper.MainActivity}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
via Stack Overflow by Rupesh Yadav.
, 1 year ago
Unable to start activity ComponentInfo{com.example.ex3dynamiclist/com.example.ex3dynamiclist.MainActivity}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.ListView
java.lang.ClassCastException: android.support.v7.widget.AppCompatTextView cannot be cast to android.widget.Button
at com.example.dysaniazzz.testdemo.MainActivity.onCreate(MainActivity.java:18)
at android.app.Activity.performCreate(Activity.java:5310)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)

Users with the same issue

You are the first who have seen this exception.

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.