Saturday, March 26, 2011

Re: [android-developers] findViewById returning NULL

Thanks

No I only have a single landscape layout.
The biggest baffle is that is works and then does not work

All I do is re-type the findViewByID part and in the layout xml re-type the android:id line
and 95% that fixes it. But this case where it does and does not work, while I am working on another section is frustrating to say the least

Thanks again


On Mar 25, 2011, at 3:13 PM, B Lyon wrote:

> Not sure if it applies in your case, but do you have a separate
> layouts for landscape and portrait and that view is defined in only
> one of them? I think the eclipse android plugin might not catch this
> kind of thing, and so you wouldn't find out until runtime that it
> wasn't in both layouts.
>
>
> On Fri, Mar 25, 2011 at 2:56 PM, New Developer <security@isscp.com> wrote:
>>
>> Sometimes not always the following line
>> final ExpandableListView menuView = (ExpandableListView)
>> findViewById(R.id.menuListing);
>> may or may not return null and thus aborts with a NullExceptionError
>> Any ideas how to fix this permanently to always return a valid
>> thanks in advance
>>
>> --
>> 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+unsubscribe@googlegroups.com
>> 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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment