一些例子是從網上找的,他有點像j2me的platformrequest,能呼叫手機平台的一些如sms,瀏覽器,mms,tel等功能
顯示網頁
uri uri = uri.parse(""); intent it = new intent(intent.action_view, uri); startactivity(it);
顯示地圖
uri uri = uri.parse("geo:38.899533,-77.036476"); intent it = new intent(intent.action_view, uri); startactivity(it); //其他 geo uri 範例 //geo:latitude,longitude //geo:latitude,longitude?z=zoom //geo:0,0?q=my+street+address //geo:0,0?q=business+near+city
撥打**
//叫出撥號程式 uri uri = uri.parse("tel:0800000123"); intent it = new intent(intent.action_dial, uri); startactivity(it); //直接打電話出去 uri uri = uri.parse("tel:0800000123"); intent it = new intent(intent.action_call, uri); startactivity(it); //用這個,要在 androidmanifest.xml 中,加上 //
傳送sms/mms
//需寫號碼sms intent it = new intent(intent.action_view); it.putextra("sms_body", "the sms text"); it.settype("vnd.android-dir/mms-sms"); startactivity(it); //傳送sms uri uri = uri.parse("smsto:0800000123"); intent it = new intent(intent.action_sendto, uri); it.putextra("sms_body", "the sms text"); startactivity(it); //傳送mms uri uri = uri.parse("content://media/external/images/media/23"); intent it = new intent(intent.action_send); it.putextra("sms_body", "some text"); it.putextra(intent.extra_stream, uri); it.settype("image/png"); startactivity(it);
傳送email
uri uri = uri.parse("mailto:***@abc.com"); intent it = new intent(intent.action_sendto, uri); startactivity(it); intent it = new intent(intent.action_send); it.putextra(intent.extra_email, "[email protected]"); it.putextra(intent.extra_text, "the email body text"); it.settype("text/plain"); startactivity(intent.createchooser(it, "choose email client")); intent it=new intent(intent.action_send); string tos=; string ccs=; it.putextra(intent.extra_email, tos); it.putextra(intent.extra_cc, ccs); it.putextra(intent.extra_text, "the email body text"); it.putextra(intent.extra_subject, "the email subject text"); it.settype("message/rfc822"); startactivity(intent.createchooser(it, "choose email client")); //傳送附件 intent it = new intent(intent.action_send); it.putextra(intent.extra_subject, "the email subject text"); it.putextra(intent.extra_stream, "file:///sdcard/mysong.***"); sendintent.settype("audio/***"); startactivity(intent.createchooser(it, "choose email client"));
android market
解除安裝應用
uri uri = uri.fromparts("package", strpackagename, null); intent it = new intent(intent.action_delete, uri); startactivity(it);
安裝應用
uri uri = uri.parse("url_of_apk_file"); intent it = new intent(intent.action_view, uri); it.setdata(uri); it.addflags(intent.flag_grant_read_uri_permission); it.setclassname("com.android.packageinstaller", "com.android.packageinstaller.packageinstalleractivity"); startactivity(it); //make sure the url_of_apk_file is readable for all users
iwidsets公告
android呼叫平台功能
android httpclient設定timeout
android與j2me移植之cliprect
android混淆(obfuscate)
how to destroy an activity in android
android應用程式logcat命令
android開玩笑之建立xml檔案
android和j2me之清屏(clearscreen)
android之view獲取getwidth()和getheight()
android之建立和讀取自定義資源檔案
android之顯示log
androd之繪製文字(fontmetrics)
**:
Android平台呼叫WebService詳解
部落格出處 手機號段歸屬地查詢 param phonesec 手機號段 public void getremoteinfo string phonesec catch exception e 獲取返回的資料 soapobject object soapobject envelope.bodyin 獲...
呼叫android系統自帶功能
intent應該算是android中特有的東西。你可以在intent中指定程式要執行的動作 比如 view,edit,dial 以及程式執行到該動作時所需要的資料。都指定好後,只要呼叫startactivity android系統會自動尋找最符合你指定要求的應用程式,並執行該程式。下面列出幾種int...
Android呼叫系統簡訊功能傳送簡訊
android呼叫系統簡訊功能傳送簡訊有兩種方法,第一種,設定傳送的號碼,和內容,介面沒有聯絡人,群組組等按鈕,如下圖所示 如下 uri smstouri uri.parse smsto 114 聯絡人位址 intent mintent new intent android.content.inte...