• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.lang.NullPointerException: Attempt to invoke virtual method

 
Ranch Hand
Posts: 36
Android Java ME
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I wanted to use ExpandableTextView, and although it's really simple code only few lines of code i stumbled in problem
I googled it alot and i think that my probem is something about styles.xml ,because i lost preview look on android studio...but can't figured what?
I read somewere about changing styles.sml to styles-21.xml but then getting an error about duplicating something..and again i am lost in dark
I got error:

I changed styles.xml:
And Activity where is my ExpandableTextView:

And my XML:
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Attempt to invoke virtual method 'void android.widget.TextView.setOnClickListener(android.view.View$OnClickListener)' on a null object reference


Do you have code that calls: setOnClickListener?
 
Milos Gojic
Ranch Hand
Posts: 36
Android Java ME
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:

Attempt to invoke virtual method 'void android.widget.TextView.setOnClickListener(android.view.View$OnClickListener)' on a null object reference


Do you have code that calls: setOnClickListener?



Yes in main activity, i have an image that when user click on it it send him to this activity...but it works in other activities...only this one is making a problem...
 
Saloon Keeper
Posts: 7597
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be that as it may, it seems the object reference that you're invoking setOnClickListener on is null - so you should check if it is.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic