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

Stack Overflow | MostafaUTD | 7 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Why does my app stop working when I switch the place of elements?

    Stack Overflow | 7 months ago | MostafaUTD
    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

    Root Cause Analysis

    1. java.lang.ClassCastException

      android.support.v7.widget.AppCompatTextView cannot be cast to android.widget.Button

      at com.example.dysaniazzz.testdemo.MainActivity.onCreate()
    2. com.example.dysaniazzz
      MainActivity.onCreate
      1. com.example.dysaniazzz.testdemo.MainActivity.onCreate(MainActivity.java:18)
      1 frame
    3. Android Platform
      ActivityThread.performLaunchActivity
      1. android.app.Activity.performCreate(Activity.java:5310)
      2. android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
      3. android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2179)
      3 frames