that is an extract of my LogCat, Peace, Gaara 06-28 14:30:18.682: WARN/dalvikvm(479): threadid=1: thread exiting with uncaught exception (group=0x40015560) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): FATAL EXCEPTION: main 06-28 14:30:18.732: ERROR/AndroidRuntime(479): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android/com.example.android.AnotherOne}: java.lang.NullPointerException 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 1647) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 1663) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at android.os.Handler.dispatchMessage(Handler.java:99) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at android.os.Looper.loop(Looper.java:123) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at android.app.ActivityThread.main(ActivityThread.java:3683) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at java.lang.reflect.Method.invokeNative(Native Method) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at java.lang.reflect.Method.invoke(Method.java:507) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:839) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at dalvik.system.NativeStart.main(Native Method) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): Caused by: java.lang.NullPointerException 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at com.example.android.AnotherOne.onCreate(AnotherOne.java:43) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1047) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 1611) 06-28 14:30:18.732: ERROR/AndroidRuntime(479): ... 11 more 06-28 14:30:18.772: WARN/ActivityManager(59): Force finishing activity com.example.android/.AnotherOne 06-28 14:30:19.312: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{4055a9c0 com.example.android/.AnotherOne} 06-28 14:30:30.929: WARN/ActivityManager(59): Activity destroy timeout for HistoryRecord{4055a9c0 com.example.android/.AnotherOne} 06-28 14:31:01.101: INFO/Process(479): Sending signal. PID: 479 SIG: 9 06-28 14:31:01.163: INFO/ActivityManager(59): Process com.example.android (pid 479) has died. 06-28 14:31:01.282: WARN/InputManagerService(59): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40716e88
On Jun 28, 2:18 pm, Mark Murphy <mmur...@commonsware.com> wrote: > Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine > LogCat and view the stack trace associated with your "force close". > > > > > > > > > > On Tue, Jun 28, 2011 at 9:51 AM, gaara <amellal.kamili...@gmail.com> wrote: > > Hi group, > > why when i use my_button.setOnClickListener(this) ; with this refers > > to my current Activity ,i got an error of Force close, what's the > > difference on having the listener directly on the button and the > > listener on the activity then override the onClick method; > > Peace, > > Gaara > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, One Low Price! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en