顯示網頁
1. uri uri = uri.parse("");
2. intent it = new intent(intent.action_view, uri);
3. startactivity(it);
顯示地圖
1. uri uri = uri.parse("geo:38.899533,-77.036476");
2. intent it = new intent(intent.action_view, uri);
3. startactivity(it);
4. //其他 geo uri 範例
5. //geo:latitude,longitude
6. //geo:latitude,longitude?z=zoom
7. //geo:0,0?q=my+street+address
8. //geo:0,0?q=business+near+city
9. 路徑規劃
1. uri uri = uri.parse("");
2. intent it = new intent(intent.action_view, uri);
3. startactivity(it);
4. //where startlat, startlng, endlat, endlng are a long with 6 decimals like: 50.123456
打**
1. //叫出撥號程式
2. uri uri = uri.parse("tel:0800000123");
3. intent it = new intent(intent.action_dial, uri);
4. startactivity(it);
1.//直接打**出去
2. uri uri = uri.parse("tel:0800000123");
3. intent it = new intent(intent.action_call, uri);
4. startactivity(it);
5. //用這個,要在 androidmanifest.xml 中,加上
6. //
傳送sms/mms
1.//呼叫簡訊程式
2. intent it = new intent(intent.action_view);
3. it.putextra("sms_body", "the sms text");
4. it.settype("vnd.android-dir/mms-sms");
5. startactivity(it);
1.//傳送訊息
2. uri uri = uri.parse("smsto://0800000123");
3. intent it = new intent(intent.action_sendto, uri);
4. it.putextra("sms_body", "the sms text");
5. startactivity(it);
1.//傳送 mms
2. uri uri = uri.parse("content://media/external/images/media/23");
3. intent it = new intent(intent.action_send);
4. it.putextra("sms_body", "some text");
5. it.putextra(intent.extra_stream, uri);
6. it.settype("image/png");
7. startactivity(it);
傳送 email
1. uri uri = uri.parse("mailto:***@abc.com");
2. intent it = new intent(intent.action_sendto, uri);
3. startactivity(it);
1. intent it = new intent(intent.action_send);
2. it.putextra(intent.extra_email, "[email protected]");
3. it.putextra(intent.extra_text, "the email body text");
4. it.settype("text/plain");
5. startactivity(intent.createchooser(it, "choose email client"));
1. intent it=new intent(intent.action_send);
2. string tos=;
3. string ccs=;
4. it.putextra(intent.extra_email, tos);
5. it.putextra(intent.extra_cc, ccs);
6. it.putextra(intent.extra_text, "the email body text");
7. it.putextra(intent.extra_subject, "the email subject text");
8. it.settype("message/rfc822");
9. startactivity(intent.createchooser(it, "choose email client"));
1. //傳送附件
2. intent it = new intent(intent.action_send);
3. it.putextra(intent.extra_subject, "the email subject text");
4. it.putextra(intent.extra_stream, "file:///sdcard/mysong.***");
5. sendintent.settype("audio/***");
6. startactivity(intent.createchooser(it, "choose email client"));
uninstall 應用程式
1. uri uri = uri.fromparts("package", strpackagename, null);
2. intent it = new intent(intent.action_delete, uri);
3. startactivity(it);
Intent用法例項
intent用法很靈活,以下列出了intent的一些常用例項,主要包括activity的跳轉及啟動 intent intent new intent activity.main.this,activity2.class startactivity intent intent intent new i...
Intent用法例項
intent用法很靈活,以下列出了intent的一些常用例項,主要包括activity的跳轉及啟動 對於資料的獲取可以採用 注 setresult int resultcode,intent data 中的引數resultcode的作用是 在上乙個activity的onactivityresult函...
Intent的應用型別
intent的應用型別 1 分類 1顯示意圖 一般應用在同一程序內 目標明確 2 隱式意圖 不同程序間 目標不太明確,根據字串底層去查詢 能用顯示不用隱式 2 實現過程 startactivity 底層框架 對應的activity startservice 底層框架 對應的service 3 int...