请我不明白为什么没有得到显示该对话框。为什么这个DialogBox没有显示?
public static void send(Message message) {
mMessage=message;
Resources res = Email.mContext.getResources();
String body = String.format(res.getString(R.string.email_send_by_sms_body), 15, 45);//WTF
AlertDialog.Builder messageBox = new AlertDialog.Builder(Email.mContext);
messageBox.setTitle(R.string.email_send_by_sms_title);
messageBox.setMessage(body);
messageBox.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
try {
sendEmail();
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
messageBox.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//doSaveDraft();
}
});
messageBox.create().show();
}
你叫'发送()'的活动中? – nKn
@NKN不,这是一个类。上下文是mContext。 –
变化'R.string.email_send_by_sms_title'用'res.getString(R.string.email_send_by_sms_title);'和'R.string.yes'就此别过 –