Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSagar Atalatti
Courses Plus Student 229 PointsUnfortunately, App has stopped running.
showFactButton.setOnKeyListener (listener);
After completing the above code is red highlighted listener and asked to Cast parameter to 'android.view.View.OnKeyListener'
Then it auto corrected to showFactButton.setOnKeyListener ((OnKeyListener) listener);
I have got a lot of errors while running the program in my AVD .
08-13 22:40:00.564 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ OfflineState{ when=-101ms what=532488 arg2=1 target=com.android.internal.util.StateMachine$SmHandler } 08-13 22:40:00.566 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ DefaultState{ when=-103ms what=532488 arg2=1 target=com.android.internal.util.StateMachine$SmHandler } 08-13 22:40:00.566 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ Forcing reevaluation 08-13 22:40:00.580 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ EvaluatingState{ when=0 what=532486 arg1=5 target=com.android.internal.util.StateMachine$SmHandler } 08-13 22:40:00.582 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ Checking http://connectivitycheck.android.com/generate_204 on epc.tmobile.com 08-13 22:40:10.673 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ Probably not a portal: exception java.net.UnknownHostException: Unable to resolve host "connectivitycheck.android.com": No address associated with hostname --------- beginning of system 08-13 22:40:10.677 346-391/? D/ConnectivityService﹕ setProvNotificationVisibleIntent: E visible=false networkType=0 extraInfo=null 08-13 22:47:55.596 346-364/? I/ProcessStatsService﹕ Prepared write state in 13ms 08-13 22:50:10.775 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ OfflineState{ when=-101ms what=532488 arg2=1 target=com.android.internal.util.StateMachine$SmHandler } 08-13 22:50:10.776 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ DefaultState{ when=-101ms what=532488 arg2=1 target=com.android.internal.util.StateMachine$SmHandler } 08-13 22:50:10.776 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ Forcing reevaluation 08-13 22:50:10.776 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ EvaluatingState{ when=0 what=532486 arg1=6 target=com.android.internal.util.StateMachine$SmHandler } 08-13 22:50:10.777 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ Checking http://connectivitycheck.android.com/generate_204 on epc.tmobile.com 08-13 22:50:10.815 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ Probably not a portal: exception java.net.UnknownHostException: Unable to resolve host "connectivitycheck.android.com": No address associated with hostname 08-13 22:50:10.818 346-391/? D/ConnectivityService﹕ setProvNotificationVisibleIntent: E visible=false networkType=0 extraInfo=null 08-13 22:50:55.822 346-687/? I/ActivityManager﹕ Killing 950:com.android.calendar/u0a17 (adj 11): empty for 1818s 08-13 22:50:55.877 346-687/? I/ActivityManager﹕ Killing 966:android.process.media/u0a5 (adj 13): empty for 1818s 08-13 22:50:55.909 346-687/? I/ActivityManager﹕ Killing 1099:com.android.settings/1000 (adj 13): empty for 1827s 08-13 22:50:55.941 346-687/? I/ActivityManager﹕ Killing 1053:com.android.managedprovisioning/u0a8 (adj 13): empty for 1830s 08-13 22:50:55.969 346-687/? I/ActivityManager﹕ Killing 1011:com.android.dialer/u0a4 (adj 13): empty for 1831s 08-13 22:50:55.999 346-687/? I/ActivityManager﹕ Killing 907:com.android.music/u0a33 (adj 13): empty for 1837s 08-13 23:00:10.889 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ OfflineState{ when=-62ms what=532488 arg2=1 target=com.android.internal.util.StateMachine$SmHandler } 08-13 23:00:10.889 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ DefaultState{ when=-63ms what=532488 arg2=1 target=com.android.internal.util.StateMachine$SmHandler } 08-13 23:00:10.889 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ Forcing reevaluation 08-13 23:00:10.890 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ EvaluatingState{ when=0 what=532486 arg1=7 target=com.android.internal.util.StateMachine$SmHandler } 08-13 23:00:10.891 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ Checking http://connectivitycheck.android.com/generate_204 on epc.tmobile.com 08-13 23:00:31.003 346-868/? D/NetworkMonitor/NetworkAgentInfo [MOBILE (UMTS) - 100]﹕ Probably not a portal: exception java.net.UnknownHostException: Unable to resolve host "connectivitycheck.android.com": No address associated with hostname 08-13 23:00:31.008 346-391/? D/ConnectivityService﹕ setProvNotificationVisibleIntent: E visible=false networkType=0 extraInfo=null 08-13 23:01:48.402 1291-1291/? D/AndroidRuntime﹕ >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<< 08-13 23:01:48.447 1291-1291/? D/AndroidRuntime﹕ CheckJNI is ON 08-13 23:01:49.751 1291-1291/? E/memtrack﹕ Couldn't load memtrack module (No such file or directory) 08-13 23:01:49.752 1291-1291/? E/android.os.Debug﹕ failed to load memtrack module: -2 08-13 23:01:50.124 1291-1291/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am 08-13 23:01:50.183 346-726/? I/ActivityManager﹕ Force stopping in.craveu.funfacts appid=10053 user=0: from pid 1291 08-13 23:01:50.219 1291-1291/? D/AndroidRuntime﹕ Shutting down VM 08-13 23:01:52.634 1303-1303/? D/AndroidRuntime﹕ >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<< 08-13 23:01:52.664 1303-1303/? D/AndroidRuntime﹕ CheckJNI is ON 08-13 23:01:53.664 1303-1303/? E/memtrack﹕ Couldn't load memtrack module (No such file or directory) 08-13 23:01:53.666 1303-1303/? E/android.os.Debug﹕ failed to load memtrack module: -2 08-13 23:01:54.224 1303-1303/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am 08-13 23:01:54.315 346-471/? I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=in.craveu.funfacts/.FunFacts} from uid 0 on display 0 08-13 23:01:54.331 346-471/? V/WindowManager﹕ addAppToken: AppWindowToken{3e0679b token=Token{3c1ecfaa ActivityRecord{1b1aa295 u0 in.craveu.funfacts/.FunFacts t3}}} to stack=1 task=3 at 0 08-13 23:01:54.567 346-370/? V/WindowManager﹕ Adding window Window{1fbdaa02 u0 Starting in.craveu.funfacts} at 2 of 7 (after Window{dab6617 u0 com.android.launcher/com.android.launcher2.Launcher}) 08-13 23:01:54.629 1303-1303/? D/AndroidRuntime﹕ Shutting down VM 08-13 23:01:55.482 68-68/? I/art﹕ Background concurrent mark sweep GC freed 780(32KB) AllocSpace objects, 0(0B) LOS objects, 91% free, 93KB/1117KB, paused 1.379ms total 650.486ms 08-13 23:01:55.603 1313-1313/? I/art﹕ Not late-enabling -Xcheck:jni (already on) 08-13 23:01:55.659 346-360/? W/ActivityManager﹕ Slow operation: 1033ms so far, now at startProcess: returned from zygote! 08-13 23:01:55.660 346-360/? W/ActivityManager﹕ Slow operation: 1034ms so far, now at startProcess: done updating battery stats 08-13 23:01:55.661 346-360/? W/ActivityManager﹕ Slow operation: 1035ms so far, now at startProcess: building log message 08-13 23:01:55.661 346-360/? I/ActivityManager﹕ Start proc 1313:in.craveu.funfacts/u0a53 for activity in.craveu.funfacts/.FunFacts 08-13 23:01:55.662 346-360/? W/ActivityManager﹕ Slow operation: 1036ms so far, now at startProcess: starting to update pids map 08-13 23:01:55.662 346-360/? W/ActivityManager﹕ Slow operation: 1036ms so far, now at startProcess: done updating pids map 08-13 23:01:55.663 346-360/? W/ActivityManager﹕ Slow operation: 1038ms so far, now at startProcess: done starting proc! 08-13 23:01:55.817 1313-1313/? W/Zygote﹕ Slow operation: 1063ms so far, now at Zygote.nativeForkAndSpecialize 08-13 23:01:55.905 1313-1313/? W/Zygote﹕ Slow operation: 1154ms so far, now at Zygote.postForkCommon 08-13 23:01:55.906 1313-1313/? W/Zygote﹕ Slow operation: 1199ms so far, now at zygoteConnection.runOnce: postForkAndSpecialize 08-13 23:01:57.842 1313-1313/? D/AndroidRuntime﹕ Shutting down VM --------- beginning of crash 08-13 23:01:57.862 1313-1313/? E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: in.craveu.funfacts, PID: 1313 java.lang.RuntimeException: Unable to start activity ComponentInfo{in.craveu.funfacts/in.craveu.funfacts.FunFacts}: java.lang.ClassCastException: in.craveu.funfacts.FunFacts$1 cannot be cast to android.view.View$OnKeyListener at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5257) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.ClassCastException: in.craveu.funfacts.FunFacts$1 cannot be cast to android.view.View$OnKeyListener at in.craveu.funfacts.FunFacts.onCreate(FunFacts.java:32) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5257) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 08-13 23:01:57.881 346-377/? W/ActivityManager﹕ Force finishing activity 1 in.craveu.funfacts/.FunFacts 08-13 23:01:58.244 346-377/? I/WindowManager﹕ Screenshot max retries 4 of Token{3c1ecfaa ActivityRecord{1b1aa295 u0 in.craveu.funfacts/.FunFacts t3 f}} appWin=Window{1fbdaa02 u0 Starting in.craveu.funfacts} drawState=4 08-13 23:01:58.931 346-752/? I/OpenGLRenderer﹕ Initialized EGL, version 1.4 08-13 23:01:59.006 346-752/? W/EGL_emulation﹕ eglSurfaceAttrib not implemented 08-13 23:01:59.007 346-752/? W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0x9fc9c400, error=EGL_SUCCESS 08-13 23:02:00.172 346-364/? W/ActivityManager﹕ Activity pause timeout for ActivityRecord{1b1aa295 u0 in.craveu.funfacts/.FunFacts t3 f} 08-13 23:02:00.380 346-364/? I/Choreographer﹕ Skipped 77 frames! The application may be doing too much work on its main thread. 08-13 23:02:00.923 638-733/? W/EGL_emulation﹕ eglSurfaceAttrib not implemented 08-13 23:02:00.924 638-733/? W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa4c4dc00, error=EGL_SUCCESS 08-13 23:02:01.674 801-801/? W/ResourceType﹕ No package identifier when getting value for resource number 0x00000000 08-13 23:02:01.675 801-801/? W/PackageManager﹕ Failure retrieving resources for in.craveu.funfacts: Resource ID #0x0 08-13 23:02:04.350 346-471/? I/ActivityManager﹕ Killing 1071:com.android.mms/u0a9 (adj 15): empty for 2486s 08-13 23:02:04.585 346-471/? E/libprocessgroup﹕ failed to kill 1 processes for processgroup 1071 08-13 23:02:05.246 638-733/? W/OpenGLRenderer﹕ Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer... 08-13 23:02:05.246 638-733/? W/OpenGLRenderer﹕ Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer... 08-13 23:02:05.444 346-667/? D/CountryDetector﹕ No listener is left 08-13 23:02:09.744 346-395/? W/AudioTrack﹕ AUDIO_OUTPUT_FLAG_FAST denied by client 08-13 23:02:10.035 346-752/? D/OpenGLRenderer﹕ endAllStagingAnimators on 0xa534ed00 (RippleDrawable) with handle 0xa5249fb0 08-13 23:02:10.377 346-686/? W/InputMethodManagerService﹕ Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@1d83e857 attribute=null, token = android.os.BinderProxy@206d0a96 08-13 23:02:10.765 1313-1313/? I/Process﹕ Sending signal. PID: 1313 SIG: 9 08-13 23:02:10.870 346-377/? I/ActivityManager﹕ Process in.craveu.funfacts (pid 1313) has died 08-13 23:02:14.388 346-407/? D/TaskPersister﹕ removeObsoleteFile: deleting file=3_task.xml
John McDonald
13,958 PointsJohn McDonald
13,958 PointsCould you show some more of your code? What are you trying to achieve?