Saturday, March 24, 2012

Re: [android-developers] NullPointerException on setOnClickListener

On Sat, Mar 24, 2012 at 12:33 PM, Vitor Pacheco <vitorpc.18@gmail.com> wrote:
> My code is returning this error and do not know how to solve it.
>
> E/AndroidRuntime(10863): java.lang.RuntimeException: Unable to start
> activity
> ComponentInfo{br.com.vitorpacheco.B2SShareFeedReader/br.com.vitorpacheco.B2SShareFeedReader.B2SShareFeedReader}:
> java.lang.NullPointerException
>
> If I comment the following line, the application works normally.
>
> btnFeed.setOnClickListener(this);

That line does not exist in your code.

> LogCat http://pastebin.com/dHhLk1TF
> Layout http://pastebin.com/R99Y8Ea3
> Activity http://pastebin.com/gV7KVK55

You must call setContentView() before calling findViewById().

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate