Android開發相關:(08)系統預制的應用程序

[java] public class IntentsUtils  

    public static void invokeBasicActivity(Activity activity) 
    { 
           String actionName= "com.androidbook.intent.action.ShowBasicView"; 
           Intent intent = new Intent(actionName); 
           activity.startActivity(intent); 
    } 
    public static void invokeWebBrowser(Activity activity) 
    { 
        Intent intent = new Intent(Intent.ACTION_VIEW); 
        intent.setData(Uri.parse("")); 
        activity.startActivity(intent); 
    } 
    public static void invokeWebSearch(Activity activity) 
    { 
        Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); 
        intent.setData(Uri.parse("")); 
        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:904-905-5646")); 
        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); 
    } 
        public static void tryOneOfThese(Activity activity) 
        { 
            IntentsUtils.call(activity); 
        } 

摘自 horsttnann的專欄

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *