button click Textview text to android inbuilt mess

2019-08-28 00:19发布

how to set my editText text into android inbuilt messaging app compose activity. here i am having code to jump from one activity to another, how to set my edittext text into inbuilt messaging app.

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条回答
Bombasti
2楼-- · 2019-08-28 01:01

Send a message:

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

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

To add a phone number :

 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:" + phoneNumber)); 
查看更多
登录 后发表回答