android 嘿,我想使用Intent对象,一切正常,但当我点击提交时,它没有打开Map应用程序

xwbd5t1u  于 2023-01-03  发布在  Android
关注(0)|答案(1)|浏览(92)
Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("geo:47.6,-122.3"));
if(intent.resolveActivity(getPackageManager())!=null)
{
    startActivity(intent);
}

我试过这个ScreenShot of Adnroid studio

Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("geo:47.6,-122.3"));
  if(intent.resolveActivity(getPackageManager())!=null)
  {
    startActivity(intent);
  }

希望让我移动到Map应用程序,但不工作

a5g8bdjr

a5g8bdjr1#

String uri = String.format(Locale.ENGLISH, "geo:%f,%f", 47.6, -122.3);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);

尝试以上代码

相关问题