Android開發之Intent跳轉到系統應用中的撥號介面、連絡人介面、簡訊介面

來源:互聯網
上載者:User

標籤:android   style   http   使用   strong   art   

現在開發中的功能需要直接跳轉到撥號、連絡人、簡訊介面等等,尋找了很多資料,自己整理了一下。
1、跳轉到撥號介面,代碼如下:

1)直接撥打

  1. Intent intentPhone = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));

    startActivity(intentPhone);

  2. 2)跳轉到撥號介面
  3. Intent intent = newIntent(Intent.ACTION_DIAL,Uri.parse("tel:" + phoneNumber));

    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    startActivity(intent);
  4. 2、跳轉到連絡人頁面,使用一下代碼:

    1. Intent intentPhone = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));
      startActivity(intentPhone);
      以下內容為轉載: Android開發之Intent跳轉到系統應用中的撥號介面、連絡人介面、簡訊介面
    現在開發中的功能需要直接跳轉到撥號、連絡人、簡訊介面等等,尋找了很多資料,自己整理了一下。

    //安裝已經存在的apk

    String filePath="mnt/sdcard/abc.apk";

    Intent intent = new  Intent(Intent.ACTION_VIEW);

    intent.setDataAndType(Uri.parse("file://" + filePath),

            "application/vnd.android.package-archive");

    startActivity(intent);//直接跳到安裝頁面,但是還要點擊按鈕確定安裝,還是取消安裝

    //卸載某應用

    String packageName="org.adw.launcher2"

    Uri packageUri = Uri.parse("package:"+packageName);//包名,指定該應用

    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri);

    startActivity(uninstallIntent);

     

    //查看某一應用程式的資訊

     Uri uri=Uri.parse("package:"+packageName);//包名,指定該應用

    Intent intent=new Intent("android.settings.APPLICATION_DETAILS_SETTINGS", uri);

    startActivity(intent); 

    2.瀏覽網頁某一具體網址

     Uri uri = Uri.parse("http://xxxxxxxxxxxxxxxxxxxxxxxx");  

     Intent intent   = new Intent(Intent.ACTION_VIEW,uri);

    //加下面這句話就是啟動系統內建的瀏覽器開啟上面的網址,  不加下面一句話,  如果你有多個瀏覽器,就會彈出讓你選擇某一瀏覽器, 然後改瀏覽器就會開啟該網址...............

    intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); 

     startActivity(intent);

    //系統  設定  介面

    Intent intent=new Intent();

     intent.setClassName("com.android.settings","com.android.settings.Settings");

    startActivity(intent); 

    //回到案頭嗎

    Intent intent = new Intent(Intent.ACTION_MAIN);

    intent.addCategory(Intent.CATEGORY_HOME);

    startActivity(intent);

    //系統   撥號    介面

    Intent intent= new Intent(Intent.ACTION_DIAL);  

    intent.setClassName("com.android.contacts","com.android.contacts.DialtactsActivity");

    startActivity(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); 

     

    //啟動撥號介面,指定了類名  包名   是系統的撥號介面    DialtactsActivity

    Intent intent= new Intent("android.intent.action.DIAL");  

     intent.setClassName("com.android.contacts","com.android.contacts.DialtactsActivity");

    startActivity(intent); 

    //系統  連絡人  介面    PeopleActivity

    Intent intent001 = new Intent();

    intent001.setClassName("com.android.contacts","com.android.contacts.activities.PeopleActivity");

    startActivity(intent001);  

    //系統  搜尋   介面    SearchActivity

    Intent intent002=new Intent();

    intent002.setClassName("com.android.quicksearchbox", "com.android.quicksearchbox.SearchActivity");

    startActivity(intent002);

    //啟動簡訊收件匣的介面,指定了包名,類名

     Intent intent4 = new Intent();

    intent4.setClassName("com.android.mms","com.android.mms.ui.ConversationList");

    startActivity(intent4);

     //啟動連絡人介面,不好

    Intent intent = new Intent();  

     intent.setAction(Intent.ACTION_PICK);  

     intent.setData(Contacts.People.CONTENT_URI);  

     startActivity(intent); 插入連絡人
    Intent intent=newIntent(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.setClassName("com.android.mms","com.android.mms.ui.ConversationList");
    startActivity(intent);
    //啟動編輯簡訊的介面
    Intent intent = new Intent(Intent.ACTION_VIEW); 
    intent.setType("vnd.android-dir/mms-sms");  
     // intent.setData(Uri.parse("content://mms-sms/conversations/"));//此為號碼
    startActivity(intent);
     轉自:http://my.eoe.cn/803369/archive/1641.html 

    1,調撥打到電話介面並播下指定號碼,但沒有打出
    Uri telUri = Uri.parse("tel:100861"); 
    returnIt = new Intent(Intent.ACTION_DIAL, telUri); 

    2.直接撥打到電話 
    Uri callUri = Uri.parse("tel:100861"); 
    returnIt = new Intent(Intent.ACTION_CALL, callUri); 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.