myTimer = new Timer();
myTask = new TimerTask() {
@Override
public void run() {
speak();
showAlertDialog_response(R.layout.dialog_response);
}
};
myTimer.schedule(myTask, 0, FREQUENCY * (60 * 100));
我使用功能说话在应用程序上说些什么。我希望该对话框响应出现每次调用“说话”功能。
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();
}