Reputation: 11632
i'm getting 2 double values (lat, lon) from shared preferences in my application.
I would like to create method which returns Location object based on given lat and long values.
Is it possible or i must use any other return type (array, list)?
If Yes, please provide any simple example for my and others.
Thanks for Your advice.
Upvotes: 1
Views: 2349
Reputation: 207
You can try this.
Location location = new Location("providername");
location.setLatitude(latitude);
location.setLongitude(longitude);
Then you can use the location object;
Upvotes: 3
Reputation: 6533
LatLng latLng = new LatLng(Double.parseDouble(getIntent().getExtras().getString("lat")),
Double.parseDouble(getIntent().getExtras()
.getString("lon")));
Upvotes: 2