File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes getting null pointer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "getting null pointer" Watch "getting null pointer" New topic
Author

getting null pointer

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1109
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
Marshal

Joined: Mar 22, 2005
Posts: 41809
    
  62
Which object is null?


Ping & DNS - my free Android networking tools app
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1109
I also need to know ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41809
    
  62
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

Joined: Nov 25, 2008
Posts: 1109
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
Marshal

Joined: Mar 22, 2005
Posts: 41809
    
  62
What does getApplicationContext() return?

What does Toast.makeText(...) return?
 
 
subject: getting null pointer