Android Wait for user input at AlertDialog to proceed

邮差的信 提交于 2019-12-02 09:54:57

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

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

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
}

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

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

Define a convenience function to show the first run dialog:

public void showFirstRunDialog(){
    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();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!