Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting null pointer  RSS feed

 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my main class


this is online class


when i click the links it gives this error


but whe i print position it gives values.
so how it gives null pointer?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which object is null?
 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also need to know ?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are not in a position to figure that out - you are. For example, you can print relevant values to the Log.

Also, in which line does the exception occur, meaning, which one is line 52 - the one labelled 52 in your post?
 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It gives null pointer in this line

Toast.makeText(getApplicationContext(), "AAAAAAAAAAAAAAAAAAAAA "+position, Toast.LENGTH_LONG).show();

but the position value is not null.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does getApplicationContext() return?

What does Toast.makeText(...) return?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!