发送短信发送消息我使用下面的代码发送消息,但我的问题是当输入一些消息时编辑文本停止输入编辑文本开始计时后30秒自动发送消息给他人如何要做到这一点帮助我如何让时间给定主意如何使用android
public void onClick(View v) {
Intent intent = getIntent();
String phone = intent.getStringExtra("pho");
String fullmsg = sendText.getText().toString();
Log.d("messga body full test", "" + fullmsg);
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phone, null, fullmsg,
null, null);
ContentValues values = new ContentValues();
values.put("address", phone);
values.put("body", fullmsg);
getContentResolver().insert(
Uri.parse("content://sms/sent"), values);
Toast.makeText(getApplicationContext(),
"SMS sent.", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(),
"SMS faild, please try again.",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
});
制作30秒后您的EDITTEXT禁用和得到什么都文本edittxt并发送。 – 2014-12-03 09:46:33
当你想停止打字? – 2014-12-03 09:51:40
当我在30秒之前键入重新启动方法 – Jai 2014-12-03 10:51:28