Skip to content Skip to sidebar Skip to footer

Android Wait For User Input At Alertdialog To Proceed

I've see this subject been discussed here but can't seem to understand how to proceed. In my onCreate I have code that checks if it is the first run of the application firstRun = g

Solution 1:

What I understand is that the changeLog will run every first run of the app. So you can override onDismiss() of your changeLog AlertDialog. Then just put your code for firstRun check

@OverridepublicvoidonDismiss(DialogInterface dialog)
{
    // firstRun Check// call function to run AlertDialog code for first check if firstRun == true else close dialog
}

Solution 2:

Take another boolean variable isChengelog and set it false initialy, when user click on ChangeLog dialog set it true and save it in preferences. Further proceeding code check

if(isChengelog){
  //Show firstRun Aleret dialog
} 
else{
 //Not Show firstRun Aleret dialog
}

Solution 3:

Like Mukesh suggested but also put this in your callback for your changelog dialog.

// On "OK clicked"publicvoidonClick(DialogInterface dialog, int id){
    pref.putBoolean("changelog", false);
    showFirstRunDialog();
}

Define a convenience function to show the first run dialog:

publicvoidshowFirstRunDialog(){
    if(getPref.getBoolean("firstRun", true);) {
        //show dialog
    }
}

Make sure you include Mukesh's suggestion on start-up:

if(getPref.getBoolean("changelog", true);){
  //Show changelog dialog
} 
else{
   showFirstRunDialog();
}

Post a Comment for "Android Wait For User Input At Alertdialog To Proceed"