Hou*_*ine 0 sms android android-intent
我使用以下代码从 Android 应用程序启动默认短信活动以发送短信:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("sms:"));
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
但我想直接在我的EditText包含文本消息的文本中设置一些文本(当我启动默认短信活动时,该文本EditText为空)。我怎样才能做到这一点 ?
问候,
这真的很简单。只需将数据添加sms_body到意图中即可
String messageBody = "This sms message"
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("sms:"));
intent.putExtra( "sms_body", messageBody );
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
989 次 |
| 最近记录: |