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();
}
what is wronge?
Used for this code just try this out:
And u whatever require for method implement and last one set to show dialog,