我想弄清楚如何从我的应用程序发送短信。我尝试了以下方法:
try {
String newNumber, newMessage;
newNumber = number.getText().toString();
newMessage = message.getText().toString();
smsManager.getDefault();
smsManager.sendTextMessage(newNumber, null, newMessage,null, null);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
};thread.start();
但我得到了一只原木猫:
07-23 09:03:42.378: I/Process(14426): 发送信号。PID: 14426 SIG: 9 07-23 09:06:18.972: W/dalvikvm(14529): threadid=11: 线程退出未捕获异常 (group=0x40a381f8) 07-23 09:06:18.972: E/AndroidRuntime(14529 ): 致命异常:Thread-885 07-23 09:06:18.972: E/AndroidRuntime(14529): java.lang.NullPointerException 07-23 09:06:18.972: E/AndroidRuntime(14529): at com.johnnydicamillo。 sms.SmsSpammerActivity$1.run(SmsSpammerActivity.java:48) 07-23 09:06:19.238: W/IInputConnectionWrapper(14529): showStatusIcon on inactive InputConnection 07-23 09:06:44.855: I/Process(14529): 发送信号。PID:14529 SIG:9