Home > database >  Hey I want to use Intent object everything is fine but when I click on submit it is not opening map
Hey I want to use Intent object everything is fine but when I click on submit it is not opening map

Time:01-03

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

I Tried this 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);
  }


Expecting to let me move to map app but not working

CodePudding user response:

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);

Try above code

  • Related