0

I would like to know what is the best way of saving the latitude and longitude from the onLocationChanged() method.

Is it by using SharedPreferences, or an I*ntent/BroadcastReceiver*?

Thanks.

Hesham Saeed
  • 5,358
  • 7
  • 37
  • 57
user1437481
  • 470
  • 1
  • 9
  • 30
  • That depends a lot on why you want to save it and what you are using it for. There's certainly lots of ways and it depends on your situation. You'll need to give more information if you want a decent answer – David Wasser Jun 29 '12 at 07:05
  • Well, have several activities that are going to use current location to calculate a distance and or send it to a REST webservice. – user1437481 Jun 29 '12 at 07:53

1 Answers1

0

I would just store it in a public static (class) variable so that all of your activities can access it. I think SharedPreferences is overkill (unless this value needs to survive when your application is killed and later restarted).

David Wasser
  • 93,459
  • 16
  • 209
  • 274