我如何查看运行Android Studio的函数的对话框

问题描述 投票:0回答:1
 myTimer = new Timer();
                    myTask = new TimerTask() {
                        @Override
                        public void run() {
                            speak();
                            showAlertDialog_response(R.layout.dialog_response);
                        }
                    };
                    myTimer.schedule(myTask, 0, FREQUENCY * (60 * 100));

我使用功能说话在应用程序上说些什么。我希望该对话框响应出现每次调用“说话”功能。

java android android-alertdialog
1个回答
0
投票
    private void showAlertDialog_response(int layout){

    dialogBuilder = new AlertDialog.Builder(Activity_punteggio.this);
    View layoutView = getLayoutInflater().inflate(layout, null);
    dialogBuilder.setView(layoutView);
    alertDialog = dialogBuilder.create();
    alertDialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
    alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    alertDialog.show();

}
© www.soinside.com 2019 - 2024. All rights reserved.