Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
两个对话框相互重叠,我想要一个接一个(Android)_Android_Dialog - Fatal编程技术网

两个对话框相互重叠,我想要一个接一个(Android)

两个对话框相互重叠,我想要一个接一个(Android),android,dialog,Android,Dialog,因此,在一个函数中,我调用了另外两个创建对话框的函数,但只显示了一个对话框(showName中的名称one) 有什么想法吗?这是我的代码: void showDialogs() { showEula(); showName(); } void showName () { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.name); dialog.setTitle

因此,在一个函数中,我调用了另外两个创建对话框的函数,但只显示了一个对话框(showName中的名称one)

有什么想法吗?这是我的代码:

void showDialogs() {
    showEula();
    showName();
}
void showName () {
    final Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.name);

    dialog.setTitle(res.getString(R.string.nameTitle));
    dialog.setCancelable(false);
    //eula objects
    final Button OK = (Button) dialog.findViewById(R.id.OK);
    final CheckBox remember = (CheckBox) dialog.findViewById(R.id.rememberName);
    final TextView name = (TextView) dialog.findViewById(R.id.name);
    if(getSharedPreferences("Settings", MODE_PRIVATE).getBoolean("rememberName",false) == true){

        name.setText(getSharedPreferences("Settings", MODE_PRIVATE).getString("Name", "Type Your Name Here"));
    }



    remember.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v){
            SharedPreferences.Editor editor = getSharedPreferences("Settings", MODE_PRIVATE).edit();
            if (remember.isChecked())  {
                editor.putBoolean("rememberName",true);
                editor.commit();
            } else {
                editor.putBoolean("rememberName",false);
                editor.commit();
            }
        }

    } );

    OK.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            SharedPreferences.Editor editor = getSharedPreferences("Settings", MODE_PRIVATE).edit();
            editor.putString("Name", name.getText().toString());
            editor.commit();
            if (getSharedPreferences("Settings", MODE_PRIVATE).getString("Name", "Type Your Name Here") == "Type Your Name Here") {
                nameEntered = false;

            } else {
                nameEntered = true;
            }
            dialog.dismiss();
            c.start();
        }
    });

    dialog.show();

}
void showEula () {
    final Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.eula);

    dialog.setTitle(res.getString(R.string.eulaTitle));
    dialog.setCancelable(false);
    //eula objects
    final Button submit = (Button) dialog.findViewById(R.id.submit);
    final CheckBox agree = (CheckBox) dialog.findViewById(R.id.agree);
 /*
    TextView agreementStatement = (TextView) dialog.findViewById(R.id.la);
    agreementStatement.setText(R.string.eula);

   agree.setText(R.string.agreement);
    submit.setText(R.string.submit);*/

    /**/
 //*

   // dialog.setCancelable(false);

  agree.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v){
           // Button  submit = (Button) findViewById(R.id.submit);
            if (agree.isChecked())  {
            submit.setEnabled(true);
            } else {
                submit.setEnabled(false);
            }
  }

} );
     submit.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            SharedPreferences.Editor editor = getSharedPreferences("Settings", MODE_PRIVATE).edit();
            editor.putBoolean("accepted",true);
            editor.commit();
            dialog.dismiss();
            showEulaComplete = true;
            //c.start();
        }} );
    dialog.show();
}
给定代码块之外的变量:

protected CountDown c;
protected boolean nameEntered;
倒计时是我制作的一个扩展倒计时的类,它工作得很好。我已经测试过很多次了


p轻松帮助

使用线程或异步任务。一个接一个地打电话。或者使用任何标志值。

创意是有成本的。该成本以代码行表示。如果没有这笔钱,我们就无法提出想法。先付钱,然后再提出你的想法;)你要我的密码吗?就在那里^