java.lang.RuntimeException

Unable to instantiate activity ComponentInfo{com.example.adi.fragment2/com.example.adi.fragment2.MainActivity}: java.lang.ClassCastException: com.example.adi.fragment2.MainActivity cannot be cast to android.app.Activity


Solutions on the web40884

Solution icon of stackoverflow
via Stack Overflow by hamster
, 7 months ago
Unable to instantiate activity ComponentInfo{com.example.adi.fragment2/com.example.adi.fragment2.MainActivity}: java.lang.ClassCastException: com.example.adi.fragment2.MainActivity cannot be cast to android.app.Activity

Solution icon of stackoverflow
via Stack Overflow by user3103823
, 1 year ago
Unable to instantiate activity ComponentInfo{com.example.ex24/com.example.ex24.MainActivity}: java.lang.ClassCastException: com.example.ex24.MainActivity cannot be cast to android.app.Activity

Solution icon of stackoverflow
Unable to start activity ComponentInfo{com.example.shopindev2/com.example.shopindev2.MainActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to android.app.Activity

Solution icon of web
via xiaomeng.io by Unknown author, 1 year ago
Unable to start activity ComponentInfo{com.example.shopindev2/com.example.shopindev2.MainActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to android.app.Activity

Solution icon of stackoverflow
Unable to start activity ComponentInfo{com.db.appform12/app.form.appform12.MainActivity}: java.lang.ClassCastException: app.form.appform12.MainActivity cannot be cast to android.view.View$OnClickListener

Solution icon of stackoverflow
Unable to start activity ComponentInfo{com.example.activity2/com.example.activity2.MainActivity}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.EditText

Solution icon of stackoverflow
via Stack Overflow by Unknown author, 1 year ago
Unable to start activity ComponentInfo{com.example.triptych4/com.example.triptych4.MainActivity}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button

Solution icon of stackoverflow
Unable to start activity ComponentInfo{com.example.customui2/com.example.customui2.MainActivity}: java.lang.ClassCastException: android.widget.ImageView cannot be cast to com.example.customui2.MainActivity$ArticleFragment$MyButton

Solution icon of stackoverflow
Unable to start activity ComponentInfo{ca.mohawk.you.lab3/ca.mohawk.you.lab3.MainActivity}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.NumberPicker

Solution icon of stackoverflow
Unable to start activity ComponentInfo{com.example.cameratest2/com.example.cameratest2.MainActivity}: java.lang.ClassCastException: android.view.SurfaceView cannot be cast to com.example.cameratest2.PreView

Stack trace

  • java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.adi.fragment2/com.example.adi.fragment2.MainActivity}: java.lang.ClassCastException: com.example.adi.fragment2.MainActivity cannot be cast to android.app.Activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2548) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

463 times, 2 days ago
27 times, 2 weeks ago
65 times, 1 month ago
6 times, 1 month ago
210 times, 1 month ago
104 more bugmates