点击链接的TextView文本到Android内置的消息应用程序应用程序、文本、消息、链接

2023-09-12 22:26:18 作者:祝你噩梦成真

如何设置我的EDITTEXT文本的Andr​​oid内置的消息应用程序撰写活动。 在这里我有code,从一个活动跳到另一个,如何设置我的EditText文本内置的消息应用程序。

 公共类msg1Screen延伸活动{

按钮simpleBtn;
@覆盖
保护无效的onCreate(包savedInstanceState){
    // TODO自动生成方法存根
    super.onCreate(savedInstanceState);
    的setContentView(R.layout.msg1);

    simpleBtn =(按钮)findViewById(R.id.button1);
    simpleBtn.setOnClickListener(新OnClickListener(){
        公共无效的onClick(视图v){
            // TODO自动生成方法存根
            意图mgActivity =新的意图(msg1Screen.this,msgScreen.class);
            startActivity(mgActivity);
        }
    });
}
 

解决方案

发送一条消息:

 意向意图=新的意图(Intent.ACTION_VIEW,Uri.parse(短信:));

 intent.putExtra(sms_body,yourEditTextString);
 startActivity(意向);
 

要添加电话号码:

 意向意图=新的意图(Intent.ACTION_VIEW,Uri.parse(短信:+ phoneNumber的));
 
Android 在 TextView 中设置超链接 颜色 字体 图片

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

解决方案

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