Android開發之Intent跳轉到系統應用中的撥號介面、聯絡人介面、簡訊介面
現在開發中的功能需要直接跳轉到撥號、聯絡人、簡訊介面等等,查找了很多資料,自己整理了一下。
首先,我們先看撥號介面,程式碼如下:
-
Intent intent =new Intent();
-
intent.setAction("android.intent.action.CALL_BUTTON");
- startActivity(intent);
和
-
Uri uri = Uri.parse("tel:xxxxxx");
-
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
- startActivity(intent);
兩者都行
但是如果是跳轉到應用,使用一下程式碼:
-
Intent intent= new Intent("android.intent.action.DIAL");
- intent.setClassName("com.android.contacts","com.android.contacts.DialtactsActivity");
到通話記錄介面:
-
Intent intent=new Intent();
-
intent.setAction(Intent.ACTION_CALL_BUTTON);
- startActivity(intent);
到聯絡人介面:
-
Intent intent = new Intent();
-
intent.setAction(Intent.ACTION_VIEW);
-
intent.setData(Contacts.People.CONTENT_URI);
- startActivity(intent);
同理,到應用:
-
Intent intent= new Intent("com.android.contacts.action.LIST_STREQUENT");
- intent.setClassName("com.android.contacts","com.android.contacts.DialtactsActivity");
呼叫聯絡人介面:
-
Intent intent = new Intent();
-
intent.setAction(Intent.ACTION_PICK);
-
intent.setData(Contacts.People.CONTENT_URI);
- startActivity(intent);
插入聯絡人
-
Intent intent=new Intent(Intent.ACTION_EDIT,Uri.parse("content://com.android.contacts/contacts/"+"1"));
- startActivity(intent);
到聯絡人列表介面
-
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
-
intent.setType("vnd.android.cursor.item/person");
-
intent.setType("vnd.android.cursor.item/contact");
-
intent.setType("vnd.android.cursor.item/raw_contact");
-
intent.putExtra(android.provider.ContactsContract.Intents.Insert.NAME, name);
-
intent.putExtra(android.provider.ContactsContract.Intents.Insert.COMPANY,company);
-
intent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, tel);
- intent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE_TYPE, 3);
到簡訊介面:
-
Intent intent = new Intent(Intent.ACTION_VIEW);
-
intent.setType("vnd.android-dir/mms-sms");
-
// intent.setData(Uri.parse("content://mms-sms/conversations/"));//此為號碼
- startActivity(intent);
到應用:
-
Intent intent = new Intent("android.intent.action.CONVERSATION");
- startActivity(intent);
以下是在網上找到的其他方法:
1.從google搜尋內容
-
Intent intent = new Intent();
-
intent.setAction(Intent.ACTION_WEB_SEARCH);
-
intent.putExtra(SearchManager.QUERY,"searchString")
- startActivity(intent);
2.瀏覽網頁
-
Uri uri = Uri.parse("http://www.google.com");
-
Intent it = new Intent(Intent.ACTION_VIEW,uri);
- startActivity(it);
3.顯示地圖
-
Uri uri = Uri.parse("geo:38.899533,-77.036476");
-
Intent it = new Intent(Intent.Action_VIEW,uri);
- startActivity(it);
4.路徑規劃
-
Uri uri = Uri.parse("http://maps.google.com/maps?f=dsaddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
-
Intent it = new Intent(Intent.ACTION_VIEW,URI);
- startActivity(it);
5.撥打電話
-
Uri uri = Uri.parse("tel:xxxxxx");
-
Intent it = new Intent(Intent.ACTION_DIAL, uri);
- startActivity(it);
和
-
uri = Uri.parse("tel:"+number);
-
intent = new Intent(Intent.ACTION_CALL,uri);
- startActivity(intent);
其中不同自己試驗一下就知道了。
6.呼叫發簡訊的程式
-
Intent it = new Intent(Intent.ACTION_VIEW);
-
it.putExtra("sms_body", "The SMS text");
-
it.setType("vnd.android-dir/mms-sms");
- startActivity(it);
和
-
uri = Uri.parse("smsto:"+要傳送簡訊的對方的number);
-
intent = new Intent(Intent.ACTION_SENDTO,uri);
- startActivity(intent);
和
-
mIntent = new Intent(Intent.ACTION_VIEW);
-
mIntent.putExtra("address", c.getString(c.getColumnIndex(column)));
-
mIntent.setType("vnd.android-dir/mms-sms");
- startActivity(mIntent);
7.傳送簡訊
-
Uri uri = Uri.parse("smsto:0800000123");
-
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
-
it.putExtra("sms_body", "The SMS text");
-
startActivity(it);
-
String body="this is sms demo";
-
Intent mmsintent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("smsto", number, null));
-
mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
-
mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, true);
-
mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, true);
- startActivity(mmsintent);<span style="font-family:Simsun;white-space: normal; background-color: rgb(255, 255, 255);"> </span>
8.傳送彩信
-
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);
-
StringBuilder sb = new StringBuilder();
-
sb.append("file://");
-
sb.append(fd.getAbsoluteFile());
-
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mmsto", number, null));
-
// Below extra datas are all optional.
-
intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_SUBJECT, subject);
-
intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
-
intent.putExtra(Messaging.KEY_ACTION_SENDTO_CONTENT_URI, sb.toString());
-
intent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, composeMode);
-
intent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, exitOnSent);
- startActivity(intent);
9.傳送Email
-
Uri uri = Uri.parse("mailto:[email protected]");
-
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={"[email protected]"};
-
String[] ccs={"[email protected]"};
-
it.putExtra(Intent.EXTRA_EMAIL, tos);
相關推薦
Android開發之Intent跳轉到系統應用中的撥號介面、聯絡人介面、簡訊介面
現在開發中的功能需要直接跳轉到撥號、聯絡人、簡訊介面等等,查找了很多資料,自己整理了一下。 首先,我們先看撥號介面,程式碼如下: Intent intent =new Intent(); intent.setAction("an
Android開發之Activity跳轉動畫以及finish動畫
Android預設的activity跳轉是不帶動畫的,但是如果想要動畫的話是有兩種方法的,一種是程式碼中加入,另外一種是寫在佈局中的theme中的 第一種: 程式碼中加入,在startActivity或者finish之後加入 ps:inAnimRe
Android跳轉系統應用
收集的一些關於android系統級別的跳轉 跳轉到視訊列表 String VIDEO_UNSPECIFIED="video/*"; Intent intent=new Intent(Intent.ACTION_GET_CONTENT); intent.setType(VIDEO_
6.Android的學習(Intent跳轉頁面,活動之間傳遞資料)
Intent跳轉頁面 (1)使用顯示Intent,首先建立一個空的活動,並且有佈局,在onClick()下面新增: Intent裡面的第一個引數是當前活動頁面,第二引數是要跳轉的活動頁面。這段程式碼在當前活動頁面。 2. (1)向下一個活動傳遞資料 · 主活動介
Android開發之Intent.Action 各種Action的常見作用
//拍攝視訊 int durationLimit = getVideoCaptureDurationLimit(); //SystemProperties.getInt("ro.media.enc.lprof.duration", 60);Intent intent = new Intent(MediaS
Android開發實現連續跳轉幾個介面後在最後一個介面完美跳回最初的介面
在實際的專案開發中也許會碰到一種情況,需要從A介面跳轉到B介面,再從B介面跳轉到C介面,再從C介面跳轉到D介面,最後需要從D介面跳回到A介面,並且把B、C 、D介面都幹掉。也許立馬會有人覺得可以在B、C、D介面跳轉時就finish()掉當前介面就可以了。但是如果需要在B
Android開發之listView使用(手機應用列表顯示)
public class MainActivity extends Activity implements OnItemLongClickListener { private ListView lv_main; private List<AppInfo> data; private App
android開發之fragment與activity之間相互跳轉
Fragment的產生與介紹 Android執行在各種各樣的裝置中,有小螢幕的手機,超大屏的平板甚至電視。針對螢幕尺寸的差距,很多情況下,都是先針對手機開發一套App,然後拷貝一份,修改佈局以適應平板神馬超級大屏的。難道無法做到一個App可以同時適應手機和平板麼
Android開發之Activity的建立跳轉及傳值
在Android系統的江湖中有四大元件:活動(Activity), 服務(Service), 廣播接收器(Broadcast Reciver)和內容提供者(Content Provider)。今天所介紹的就是Android開發中的四大元件之一:Activity,其他那三大元件
Android開發之實現蘋果瀏覽器網頁跳轉動畫
前言:上一章《Android開發之安卓屬性動畫大總結》大致介紹了安卓的屬性動畫以及使用時的注意點,今天我們就來一個小綜合案列,實現類似於蘋果瀏覽器的跳轉頁面! ----------------------分割線------------------------ 來看下效果圖:
Android開發之--從app中跳轉到淘寶店鋪
首先、一個工具類 方法,檢測該包名下的應用是否存在 public static boolean checkPackage(Context context ,String packageName) { if (packageName == null || "".
轉Android開發之增量更新
avt exp chm 這一 font ams extern city ron 一、使用場景 apk升級,節省服務器和用戶的流量 二、原理 自從 Android 4.1 開始, Google Play 引入了應用程序的增量更新功能,App使用該升級方式,可節省約2/3
Android 跳轉系統選擇本地視頻的功能
選擇 打開文件 result 打開圖片 provide ati 迷你 nal 名稱 今天在項目開發的過程中產品要求添加選擇本地視頻的功能,於是就翻閱和查找各種資料,進行功能的開發,但是在開發過程中發現,各種不同的品牌的手機跳轉至系統選擇本地視頻的功能結果不太一樣,所以我
android入門開發之Intent學習
Intent的四種開啟方式(顯示開啟): //顯示intent第一種方式 Intent intent = new Intent(); intent.setClass(this, Activity_one.class); start
android 開發之 ListView 與Adapter 應用實踐
在開發android中,ListView 的應用顯得非常頻繁,只要需要顯示列表展示的應用,可以說是必不可少,下面是記錄開發中應用到ListView與Adapter 使用的例項: ListView 所在頁面中的佈局(listview_item.xml): <?xml version="1.0"
安卓開發中傳送簡訊的方法 APP內單發簡訊 群發簡訊 APP跳轉到簡訊頁 單條簡訊 多條簡訊Intent跳轉
1.APP內部直接傳送短息 包括髮送單條簡訊 傳送多條簡訊 APP內部發送簡訊首先要獲取一個傳送簡訊的許可權 <uses-permission android:name="android.permission.SEND_SMS"/> 安卓6.0以上的手機要動態獲取到這個許可
Android跳轉系統設定Settings的各個介面
系統定義的常量 有時候需要跳轉到一些系統設定介面,為了方便尋找總結一下 定義Intent 相關介面 ACTION_SETTINGS 系統設定介面 ACTION
Android開發之應用狀態列、導航欄都透明
直接上程式碼 //狀態列、導航欄都透明 private void hideStatusBarNavigationBar() { if (Build.VERSION.SDK_INT = Build.VERSION_CODES.LOLLIPOP)
Android開發之系統音訊庫載入全過程
本文基於android7.0分析 在介紹解析音訊配置檔案文章中 已經說了,系統音訊庫的載入與否取決audio_policy.conf是否有配置其資訊。 當將audio_policy.conf解析完成之後,接下來就是根據解析好的配置檔案資料去載入系統音訊庫,我們繼續看到
Android跳轉系統通知許可權設定
測試過華為、小米、魅族跳轉下列程式碼可以支援 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Intent intent = new Intent();