2016-08-22 67 views

回答

0

试试这个代码:

private void openWhatsApp(String id) { 
Cursor c =  
    getSherlockActivity().getContentResolver().query(
    ContactsContract.Data.CONTENT_URI, 
    new String[] { ContactsContract.Contacts.Data._ID },  

    ContactsContract.Data.DATA1 + "=?", 
    new String[] { id }, null); 
    c.moveToFirst(); 
Intent i = new Intent(Intent.ACTION_VIEW,  

Uri.parse("content://com.android.contacts/data/" + c.getString(0))); 

startActivity(i); 
c.close(); 
} 

其中id是什么应用程序的URI像

[email protected]

+0

感谢您的答复,但它不为未知的号码工作。我需要发送邮件给未知的联系人 –

+0

@sarikakashid Whatsapp打开聊天记录,但不会根据您的代码将文本发送出去 –

相关问题