我可以找到更多信息,例如错误中的行

时间:2015-09-26 20:56:31

标签: android-studio error-handling

我没有发现问题可以在错误中看到它在哪里或者我能找到附近的信息而不仅仅是Integer cannot be cast to java.lang.String

3485-3485/com.example.tobias.uebung1 E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.tobias.uebung1, PID: 3485
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tobias.uebung1/com.example.tobias.uebung1.main}: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
            at android.app.SharedPreferencesImpl.getString(SharedPreferencesImpl.java:225)
            at com.example.tobias.uebung1.main.Main(main.java:440)
            at com.example.tobias.uebung1.main.onCreate(main.java:106)
            at android.app.Activity.performCreate(Activity.java:6237)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

1 个答案:

答案 0 :(得分:0)

我不知道我们应该如何提供帮助,但我认为你现在能做的最好的事情就是添加一些断点并进行调试。或者您可以发布代码,以便我们提供帮助。