是否可以将短信发送到设备或安卓手机,以便短信在指定时间(比如 30 分钟)后自行删除?我用来发送短信的代码是:`
public class SMSTestActivity extends Activity {
/** Called when the activity is first created. */
String str, str1;
@Override
public void onCreate(Bundle savedInstanceState) {
final Button btn;
final EditText etb, etb1;
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btn=(Button) findViewById(R.id.btn);
etb=(EditText) findViewById(R.id.txtMsg);
etb1=(EditText)findViewById( R.id.phNum);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
str=etb.getText().toString();
str1=etb1.getText().toString();
sendSms( str1, str);
}
});
}
private void sendSms(String phonenumber, String message)
{
SmsManager x=SmsManager.getDefault();
x.sendTextMessage(phonenumber, null, message, null, null);
}
public void display(View v)
{
final Button bt;
bt=(Button) v;
bt.setText("Hello");
}
}