【问题标题】:How do i link my android app to another built in application like google maps?如何将我的 android 应用程序链接到另一个内置应用程序,如谷歌地图?
【发布时间】:2013-03-19 13:43:24
【问题描述】:

我想知道我是否可以将我的应用程序与谷歌地图等应用程序链接?例如,如果我创建一个按钮,onClick 我会转到 Google 地图应用程序。那么有没有办法可以将按钮的 onClick 事件直接指向地图?如果是这样,我该怎么做?

【问题讨论】:

标签: java android eclipse onclick


【解决方案1】:

你可以通过意图来实现,如果你想从你的应用中打开谷歌地图,你可以用这个代码来实现:

String uri = "geo:"+ latitude + "," + longitude;
Intent myMapIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(myMapIntent);

你可以在related Android Documentation找到一些有用的信息

【讨论】:

    【解决方案2】:

    你可以使用

    geo:latitude,longitude
    geo:latitude,longitude?z=zoom
    geo:0,0?q=my+street+address
    geo:0,0?q=business+near+city
    

    来自Android Developer guide

    【讨论】:

      【解决方案3】:
      Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
      Uri.parse("http://maps.google.com/maps?saddr="+mylocation));
      startActivity(intent);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-10-07
        • 2021-04-28
        • 2012-07-04
        • 2014-10-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多