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

Stack Overflow | kavya | 2 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    I am working on display toast message when Wi-Fi turned on/off, I am getting error as below

    Stack Overflow | 2 months ago | kavya
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.pmap.wifitoast/com.example.pmap.wifitoast.MainActivity}: java.lang.ClassCastException: com.example.pmap.wifitoast.MainActivity cannot be cast to android.app.Activity
  2. 0

    Using SharedPreferences crashes app with java.lang.NullPointerException

    Stack Overflow | 4 years ago | user2507301
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.currencyconverter/com.example.currencyconverter.MainActivity2}: java.lang.NullPointerException
  3. 0

    How to pass data from one app to another in android

    Stack Overflow | 3 years ago | user3747512
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.piechartexample/com.example.piechartexample.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Android EditText not loading

    Stack Overflow | 4 years ago | user2209542
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.methanegaszonegeolocator/com.example.methanegaszonegeolocator.MainActivity}: java.lang.NullPointerException
  6. 0

    Bluetooth Fatal Exception Main android

    Stack Overflow | 3 years ago | user2246076
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.real/com.example.real.MainActivity}: java.lang.NullPointerException

  1. ahmed 6 times, last 1 week ago
  2. justCodeit 59 times, last 2 weeks ago
  3. Donsy 4 times, last 1 month ago
  4. Adrien 2 times, last 2 months ago
  5. rp 1 times, last 3 months ago
77 more registered users
18 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.ClassCastException

    com.example.pmap.wifitoast.MainActivity cannot be cast to android.app.Activity

    at android.app.Instrumentation.newActivity()
  2. Android Platform
    ActivityThread.main
    1. android.app.Instrumentation.newActivity(Instrumentation.java:1089)
    2. android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2240)
    3. android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413)
    4. android.app.ActivityThread.access$800(ActivityThread.java:155)
    5. android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
    6. android.os.Handler.dispatchMessage(Handler.java:102)
    7. android.os.Looper.loop(Looper.java:135)
    8. android.app.ActivityThread.main(ActivityThread.java:5343)
    8 frames
  3. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:372)
    2 frames
  4. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
    2 frames