Issue
I have a web view that shows google maps on my android activity. I am currently getting the link that contains the latitude and longitude values of the selected location by clicking a button. What I want to know is, how can I extract and save the latitude and longitude values in to variables? I tried this code but it doesn't seem to work
Uri uri = Uri.parse(str);
uri.getQueryParameter(q1);
Solution
If you have the url as a String, named str:
String[] part1 = str.split(Pattern.quote("@"));
String[] part2 = part1[1].split(Pattern.quote(","));
double lat = Double.parseDouble(part2[0]);
double lon = Double.parseDouble(part2[1]);
Answered By - Ruocco
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.