Saturday, July 9, 2011

[android-developers] Re: NullPointerException when checking for orientation

Thanks, Kostya, I found it. It was the getActivity().

On Jul 7, 12:05 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
> A complex expression like this can cause a bit of confusion with line
> numbers.
>
> You can watch it in the debugger, while single-stepping, the current
> line can jump down and up. I suppose it's the same with getting the
> stack trace.
>
> To pinpoint what's going on, rewrite this section of code to use local
> temporary objects, something along these lines:
>
> if((ViewByRoom.controls&  CAN_DISPLAY_QUEUE) == CAN_DISPLAY_QUEUE) {
> {
>         Activity activity = getActivity();
>         View view = activity.findViewById(R.id.queueframe);
>         if (view == null) {
>                 // old code here
>         }
>
> }
>
> -- Kostya
>
> 07.07.2011 21:28, Kim пишет:
>
> > Is it possible that the exception is actually caused by the
> > getActivity(), even though the LogCat is pointing to the .findViewByID
> > line?
>
> --
> Kostya Vasilyev

--
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