Android調(diào)用平臺功能具體技巧分享
作者:佚名 
  我們在這篇文章中為大家總結(jié)的Android調(diào)用平臺功能都包括有:顯示網(wǎng)頁;顯示地圖;撥打電話;發(fā)送SMS/MMS等等。
 Android操作系統(tǒng)那個可以通過調(diào)用手機平臺來實現(xiàn)一些特定的功能,諸如網(wǎng)頁的顯示,郵件的發(fā)送等等。那么今天就為大家總結(jié)了幾個Android調(diào)用平臺功能的應用技巧,幫助大家增加編程經(jīng)驗。
Android調(diào)用平臺功能之顯示網(wǎng)頁
- Uri uri = Uri.parse("http://google.com");
 - Intent it = new Intent(Intent.ACTION_VIEW, uri);
 - startActivity(it);
 - Uri uri = Uri.parse("http://google.com");
 - Intent it = new Intent(Intent.ACTION_VIEW, uri);
 - startActivity(it);
 
Android調(diào)用平臺功能之顯示地圖
- 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
 - //google.streetview:cbll=lat,lng&cbp=1,yaw,,pitch,
 
zoom&mz=mapZoom- 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
 - //google.streetview:cbll=lat,lng&cbp=1,yaw,,pitch,
 
zoom&mz=mapZoom
Android調(diào)用平臺功能之撥打電話
- //叫出撥號程式
 - 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 中,加上
 - //< uses-permission id="android.permission.CALL_PHONE" />
 - //叫出撥號程式
 - 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 中,加上
 - //< uses-permission id="android.permission.CALL_PHONE" />
 
Android調(diào)用平臺功能之發(fā)送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);
 - //發(fā)送SMS
 - Uri uri = Uri.parse("smsto:0800000123");
 - Intent it = new Intent(Intent.ACTION_SENDTO, uri);
 - it.putExtra("sms_body", "The SMS text");
 - startActivity(it);
 - //發(fā)送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);
 - //需寫號碼SMS
 - Intent it = new Intent(Intent.ACTION_VIEW);
 - it.putExtra("sms_body", "The SMS text");
 - it.setType("vnd.android-dir/mms-sms");
 - startActivity(it);
 - //發(fā)送SMS
 - Uri uri = Uri.parse("smsto:0800000123");
 - Intent it = new Intent(Intent.ACTION_SENDTO, uri);
 - it.putExtra("sms_body", "The SMS text");
 - startActivity(it);
 - //發(fā)送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);
 
Android調(diào)用平臺功能的相關(guān)內(nèi)容就為大家介紹到這里。
【編輯推薦】
責任編輯:曹凱 
                    來源:
                    javaeye.com
 














 
 
 
 
 
 
 