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 | 4 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards 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 | 4 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

    java.lang.RuntimeException: Unable to instantiate activity

    Stack Overflow | 5 years ago | pravallika
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.skeletonapp/com.example.android.skeletonapp.SkeletonActivity}: java.lang.InstantiationException: com.example.android.skeletonapp.SkeletonActivity

  1. Indri Yunita 76 times, last 3 days ago
  2. andreeaa marin 8 times, last 3 weeks ago
  3. ahmed 6 times, last 1 month ago
  4. justCodeit 59 times, last 2 months ago
  5. Donsy 4 times, last 3 months ago
78 more registered users
17 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