2017-08-24 36 views
1

here,下面的例子給出:使用Intent.ACTION_SENDTO時在哪裏指定電話號碼?

public void composeMmsMessage(String message, Uri attachment) { 
    Intent intent = new Intent(Intent.ACTION_SENDTO); 
    intent.setType(HTTP.PLAIN_TEXT_TYPE); 
    intent.putExtra("sms_body", message); 
    intent.putExtra(Intent.EXTRA_STREAM, attachment); 
    if (intent.resolveActivity(getPackageManager()) != null) { 
     startActivity(intent); 
    } 
} 
哪裏目的地號碼指定

回答

1
Uri uri = Uri.parse("smsto:xxxxxxxxxx"); 
Intent intent = new Intent(Intent.ACTION_SENDTO, uri); 
0

不是。這是該代碼中的一個錯誤。 ACTION_SENDTO需要一個smsto:mailto:Uri

Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:123456")); 

其中123456是所希望的電話號碼。