button click Textview text to android inbuilt messaging app

冷暖自知 提交于 2019-12-13 04:48:33

问题


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:


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)); 


来源:https://stackoverflow.com/questions/27671131/button-click-textview-text-to-android-inbuilt-messaging-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!