按钮单击Textview文本到android内置消息应用程序

时间:2014-12-27 20:23:18

标签: android android-activity android-edittext messaging

如何将我的editText文本设置为android内置消息应用程序撰写活动。 这里我有代码从一个活动跳转到另一个活动,如何将我的edittext文本设置为内置的消息传递应用程序。

public class msg1Screen extends Activity {

Button simpleBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.msg1);  

    simpleBtn=(Button)findViewById(R.id.button1);
    simpleBtn.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent mgActivity = new Intent(msg1Screen.this, msgScreen.class);     
            startActivity(mgActivity);  
        }
    });
}

1 个答案:

答案 0 :(得分:0)

发送消息:

 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:"));        

 intent.putExtra("sms_body", yourEditTextString);
 startActivity(intent);

添加电话号码:

 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:" + phoneNumber)); 
相关问题