Ressor wrote:Opps! I freaked out too soon and figure it out on my own.
can i ask you to post an example of how you use this code?
can help many people, starting me
Ressor wrote:This is the Location Manager class:
I cut and paste the code for the class into my project and give it a relevant name like MyLocationManager.java
And then this is how I use it in my other Activity:
I declare a variable to hold the reference to the object above the onCreate in my Activity:
private MyLocationManager mlm;
I instanciate it like this from within the onCreate:
mlm = new MyLocationManager(getBaseContext());
Location location = mlm.getCurrentLocation();
String lat = Double.toString(location.getLatitude());
String lng = Double.toString(location.getLongitude());
That is about it...
Then I call the other methods from it to stop and start as needed.
Users browsing this forum: No registered users and 3 guests