对话没有显示 [英] Dialog didn't show
本文介绍了对话没有显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图弹出一个对话框,当用户在备份数据库的覆盖,所以我写了这篇code,但它没有工作:
I am trying to pop up a dialog when the user overwrite on a backup database so I wrote this code but it didn't work:
$if(backupDB.exists()){
AlertDialog.Builder builder = new AlertDialog.Builder(getBaseContext());
builder.setTitle("Backup database...");
builder.setMessage("You have already backup the database, do you want to overwrite?");
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Intent i=new Intent(getBaseContext(),FinancialSecretary.class);
finish();
startActivity(i);
}
});
AlertDialog dialog = builder.create();
}
是什么wronge?
what is wronge?
推荐答案
用于此code只是尝试了这一点:
Used for this code just try this out:
AlertDialog.Builder builder = new AlertDialog.Builder(ActivityName.this);
和U无论需要实施的方法和最后一组显示对话框,
And u whatever require for method implement and last one set to show dialog,
builder.show();
这篇关于对话没有显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文