我使用 - 创建了一个简单的对话框
Dialog dialog = new Dialog(Myactivity.this);
dialog.setContentView(R.layout.myLayout);
dialog.show();
当我显示和关闭此对话框时,我想更新 MyActivity
中的 textView。所以我在 onResume()
中放了一些东西,假设它在您关闭 dialog
时被调用。
是真的吗?或者我们有任何其他方式来更新此 textView
吗?
最佳答案
您可以更新您的 TextView
实现 OnDismissListener interface :
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
//update your textView
}
});
关于android - 显示对话框将调用哪个 Activity 生命周期函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25627262/