我想在ACTION_UP中显示进度对话框,对于一些奇怪的原因,它不工作,我没有看到日志中的任何错误,ACTION_UP块中的所有内容都在工作,除了进度对话?任何人有任何想法发生了什么?ProgressDialog没有显示 - Android
我甚至加吐司,以测试它和它的作品就好了... ...
button.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View view, MotionEvent event) {
if (event.getAction() == android.view.MotionEvent.ACTION_DOWN) {
//works here
//progress = ProgressDialog.show(context,"Processing...","Preparing your file", true);
} else if (event.getAction() == android.view.MotionEvent.ACTION_UP ) {
Toast toast;
duration = Toast.LENGTH_LONG;
toast = Toast.makeText(context, text, duration);
toast.show();//this work and the toast is getting displayed
progress = ProgressDialog.show(context,"Processing...","Preparing your file", true);
}
return true;
}
});
我能够调用显示在主线程在我的项目... –
正如我有时说,有时工作,它不:) – thunder413
或者你可以使用真棒素材库https://开头github.com/afollestad/material-dialogs – thunder413