在我的应用程序中,我想以编程方式为我的应用程序打开 Android SMS 创建窗口。怎么做?
这可能有帮助,也可能没有帮助。
// LAUNCH SMS EVENT HANDLER
final Button buttonLaunchSMS= (Button)findViewById(R.id.ButtonLaunchSMSMessage);
buttonLaunchSMS.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String outCipherText= editTextSMSCipherText.getText().toString();
String phoneNumber= editTextPhoneNumber.getText().toString();
// pre-conditions
if (outCipherText.length() < 1){
editTextSMSCipherText.setError("Cipher Text is Empty");
editTextSMSCipherText.requestFocus();
return;
}
if (outCipherText.length()>MAX_SMS_CHAR){
editTextSMSCipherText.setError("Error. Message Is Too Large.");
editTextSMSCipherText.requestFocus();
return;
}
String uri= "smsto:"+phoneNumber;
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
intent.putExtra("sms_body", outCipherText);
intent.putExtra("compose_mode", true);
startActivity(intent);
finish();
}
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)