I have two intents that I would like Users to choose from. One intent is for driving directions via Google Maps and the other is through Google Navigation (Beta). This is how I set up each Intent:
//regular maps
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=40.7143528,-74.0059731"));
//navigation
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("google.navigation:40.7143528,-74.0059731"));
I think I have to use Intent.createChooser() but I’m not sure how to implement it with specific intents. I’ve used it before with email like so:
startActivity(Intent.createChooser(emailIntent, "Send your email in:"));
where emailIntent is set up here:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
Thank you in advance!!!!
You have to do it manually.
createChooseropens a dialog with a list of apps that can handle one specific intent. On the other hand, what you have is two different intents… so just create a dialog with the two options. Take a look at this example.