Some Android built-in Intents

person Jason Huangfolder_openAndroidlocal_offer, access_time November 9, 2010

Examples of how to use some Android built-in intents.

public static void invokeWebBrowser(Activity activity) 
    { 
       Intent intent = new Intent(Intent.ACTION_VIEW); 
       intent.setData(Uri.parse("http://www.google.com")); 
       activity.startActivity(intent); 
    } 
    public static void invokeWebSearch(Activity activity) 
    { 
       Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); 
       intent.setData(Uri.parse("http://www.google.com")); 
       activity.startActivity(intent); 
    } 
    public static void dial(Activity activity) 
    { 
       Intent intent = new Intent(Intent.ACTION_DIAL); 
       activity.startActivity(intent); 
    } 
 
    public static void call(Activity activity) 
    { 
       Intent intent = new Intent(Intent.ACTION_CALL); 
       intent.setData(Uri.parse("tel:555-555-5555")); 
       activity.startActivity(intent); 
    } 
    public static void showMapAtLatLong(Activity activity)  
    { 
       Intent intent = new Intent(Intent.ACTION_VIEW); 
       //geo:lat,long?z=zoomlevel&q=question-string 
       intent.setData(Uri.parse("geo:0,0?z=4&q=business+near+city"
       activity.startActivity(intent); 
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>