Hi Kostya, Thanks for the comments. That's (SampleConnection.java line 275 ) actually where I am calling the setText() method and thus getting the null reference occurence. Anyway, it seems I've found the problem. It was an accidental copy/paste operation which replaced the location of initializing the TextView with setContentView(). Cheers, Emre
Date: Fri, 12 Nov 2010 15:44:45 +0300 From: [email protected] To: [email protected] Subject: Re: [android-developers] how to call the setText() method in an Activity that is part of a Tab Layout ? Emre, Ok, good, so that's your logcat stack trace for the crash. And it has the whole story about the crash. The "what happened" is this: 11-12 12:34:15.666: WARN/dalvikvm(510): threadid=3: thread exiting with uncaught exception (group=0x40013140) The "what it its immediate cause" is this: 11-12 12:34:15.696: ERROR/AndroidRuntime(510): java.lang.NullPointerException The "where things went wrong" is this: 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at com.android:sample.SampleConnection.updateWithNewLocation(SampleConnection.java:275) Look in SampleConnection.java, line 275, you should see your updateWithNewLocation method (modified sample?). On that line, you will find code that uses a null reference. -- Kostya 12.11.2010 15:07, Emre A. Yavuz пишет: I know ... ; ) This is what I meant by "not much": 11-12 12:34:15.666: WARN/dalvikvm(510): threadid=3: thread exiting with uncaught exception (group=0x40013140) 11-12 12:34:15.666: ERROR/AndroidRuntime(510): Uncaught handler: thread main exiting due to uncaught exception 11-12 12:34:15.696: ERROR/AndroidRuntime(510): java.lang.NullPointerException 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at com.android:sample.SampleConnection.updateWithNewLocation(SampleConnection.java:275) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at com.android:sample.SampleConnection.access$1(SampleConnection.java:182) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at com.android:sample.SampleConnection$1.onLocationChanged(SampleConnection.java:115) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:181) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:114) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:130) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at android.os.Handler.dispatchMessage(Handler.java:99) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at android.os.Looper.loop(Looper.java:123) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at android.app.ActivityThread.main(ActivityThread.java:3948) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at java.lang.reflect.Method.invokeNative(Native Method) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at java.lang.reflect.Method.invoke(Method.java:521) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 11-12 12:34:15.696: ERROR/AndroidRuntime(510): at dalvik.system.NativeStart.main(Native Method) I have initialized the TextView for which I am setting the text. However, I now have an idea why this situation might have occured. Emre PS. SampleConnection class updates the location on the display as it changes. Date: Fri, 12 Nov 2010 14:09:57 +0530 Subject: Re: [android-developers] how to call the setText() method in an Activity that is part of a Tab Layout ? From: [email protected] To: [email protected] Not much !!! :) In Java, NullPointer is pretty too much. You might not have initialized the TextView for which you are setting the text. Look into the logcat for more details. It will give you the line number where this exception is being generated. On Fri, Nov 12, 2010 at 1:59 PM, Emre A. Yavuz <[email protected]> wrote: Not much, just NullPointer .... Emre Date: Fri, 12 Nov 2010 10:37:56 +0530 Subject: Re: [android-developers] how to call the setText() method in an Activity that is part of a Tab Layout ? From: [email protected] To: [email protected] What does it complain about? Look at your logcat. On Fri, Nov 12, 2010 at 5:25 AM, Emre A. Yavuz <[email protected]> wrote: Hi, I have created a Tab Layout based on the sample code given in the "Tutorials" section on the Android website. I have two Tabs with two Activities for each one of them. All I want to do is to update a "TextView" variable that belongs to a layout of one of the Activities when needed using the setText() method (for whichever activity being displayed at that moment). However it keeps on complaining during runtime and thus the text is never set. I was able to achieve this display update when I was using a single layout by just setting the text of the mentioned TextView variable. It should have something to do with the Tab Layout, but what ? Any ideas ? Cheers, Emre -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

