当用户覆盖备份数据库时,我试图弹出一个对话框,所以我编写了这段代码,但它没有用:
$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();
}
什么是错?