Results 21 to 24 of 24
Thread: Why I'm getting NULL
- 11-09-2011, 12:35 AM #21
Member
- Join Date
- Nov 2010
- Posts
- 75
- Rep Power
- 0
Re: Why I'm getting NULL
i have the following structure..please tell me how to do what have you told me
Java Code:public class CarCurrentPositionActivity extends Activity implements LocationListener {.. ... LocationListener loclisten = new CarCurrentPositionActivity(); loclisten.onLocationChanged((Location) loclisten); ...... ...... ...... locationManager.requestLocationUpdates(...,...,...., loclisten); ... ... } public void onLocationChanged(Location loc) // accepts only arguments of type Location { ... ... }Last edited by Norm; 11-09-2011 at 12:38 AM. Reason: changed quote to code tags
- 11-09-2011, 12:46 AM #22
Re: Why I'm getting NULL
You are using the same listener in two places. Its strange that you are passing a reference to the listener to the listener itself:
loclisten.onLocationChanged((Location) loclisten);
I have no idea why you would do that. ????
Why do you cast the listener to a Location? That does not make sense.
You didn't post the definition for LocationListener. Is the onLocationChanged method in that interface?
The locationManager object is given a reference to the listener. When the locationManger has a Location event it will call the listener.
- 11-09-2011, 12:51 AM #23
Member
- Join Date
- Nov 2010
- Posts
- 75
- Rep Power
- 0
- 11-09-2011, 12:54 AM #24
Similar Threads
-
Is it better to set array elements to null before setting the arrayreference to null?
By kreyszig in forum Advanced JavaReplies: 6Last Post: 10-18-2010, 10:40 AM -
Null :(
By PhQ in forum Advanced JavaReplies: 4Last Post: 04-12-2010, 01:05 AM -
JOptionPane.showMessageDialog(null,"Etc Etc"); - What does null actually do?
By markious in forum New To JavaReplies: 2Last Post: 03-19-2010, 05:30 PM -
Null
By leapinlizard in forum New To JavaReplies: 4Last Post: 04-29-2009, 11:29 PM -
What is NULL
By bugger in forum New To JavaReplies: 1Last Post: 01-09-2008, 04:55 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks