我在创建 AlertDialog 时遇到问题。无论我做什么,标题和消息总是空的,这是我的代码:
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BigActivity.this);
dialogBuilder
.setTitle(item.getTitle())//no problem whith getters
.setMessage(item.getMessage())
.setIcon(R.drawable.ic_launcher)
.setNegativeButton(R.string.cerrar, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
;
AlertDialog dialog = dialogBuilder.create();
dialog.show();
任何帮助,将不胜感激
附言
System.out.println(item.getTitle()+" "+item.getMessage())
工作正常。