06/10/2010

Using Intent to make a phone call

To make a phone call by using Intents in Android you first have to create an URI object, by parsing specifically formatted string, as follows:

URI uri = Uri.parse("tel:+44123456789");
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(uri);
startActivity(intent);

Using an Intent to open Google Maps on the given location

To open Google Maps activity, you simply need to know latitude and longitude, pass these numbers to the URI parser:

Uri uri = Uri.parse("geo:37.386052,-122.083851");
Intent i = new Intent(Intent.ACTION_VIEW , uri);
startActivity(i);


It's quite simple to find latitude and longitude of a given location by using some free websites, e.g.: http://itouchmap.com/latlong.html