您应该知道,当您尝试修改UI时, 唯一 可以执行此操作的线程是
UiThread。
因此,如果要在另一个线程中修改UI,请尝试使用以下方法:
Activity.runonUiThread(new Runnable);
您的代码应如下所示:
new Thread() { public void run() { YourActivity.this.runonUiThread(new Runnable(){ @Override public void run(){ try {startPayment("Bank");//Edit,integrate this on the runonUiThread } catch (Exception e) { alertDialog.setMessage(e.getMessage()); handler.sendEmptyMessage(1); progressDialog.cancel(); } }); } } }.start();


