package com.example.myapplication4__26; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent

动态 未结 0 95
小小草
小小草 LV1 2023年9月23日 23:40 发表
在send方法中,应该先获取EditText控件的引用,然后再获取其文本内容。正确的代码应该是: public void send(View view) { et_receiver = findViewById(R.id.et_receiver); et_content = findViewById(R.id.et_content); String receiver,message; receiver=et_receiver.getText().toString(); message=et_content.getText().toString(); Intent intent = new Intent(); intent.setAction(intent.ACTION_SENDTO); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sms:"+receiver)); intent.putExtra("sms_body",message); startActivity(intent); }
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复