Android Wait for user input at AlertDialog to proceed

前端 未结 3 1060
忘掉有多难
忘掉有多难 2021-01-28 06:06

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 th

3条回答
  •  故里飘歌
    2021-01-28 06:38

    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();
    }
    

提交回复
热议问题