Issue
I have a MapView
in my application. I've gotten it to work as I want it to but I'd like to handle all the onClick
or an equivalent event of the MapView
and open the Google Maps application.
I've read that I can open the Google Maps application but raising an Intent
like this:
String uri = "geo:"+ latitude + "," + longitude;
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
How can I trap the aforementioned event of my MapView
? I haven't been able to figure this out. Thanks.
Solution
I used the onTap
event like this:
public boolean onTap(GeoPoint gptLocation, MapView mapMap) {
String strCoordinates = String.format("%f,%f", gptCoordinates.getLatitudeE6() / 1E6, gptCoordinates.getLongitudeE6() / 1E6);
String strUri = String.format("geo:%s?z=14", strCoordinates);
Intent ittMap = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(strUri));
ittMap.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.ctxContext.startActivity(ittMap);
return false;
}
Answered By - Mridang Agarwalla
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.