open google maps through intent for specific location in android

后端 未结 12 1113
别那么骄傲
别那么骄傲 2020-11-30 20:17

I\'m designing one application in which I want to show specific location on Map. I\'m passing String of address which is already placed on Google Map

12条回答
  •  一生所求
    2020-11-30 20:44

    To show location and disply show directions button inside google Maps use this code snippet:

    String geoUri = "http://maps.google.com/maps?q=loc:" + latitude + "," + longitude + " (" + locationName + ")";
    Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUri));
    if (mapIntent.resolveActivity(context.getPackageManager()) != null) {
        context.startActivity(mapIntent);
    

提交回复
热议问题