我已经这样做了:
doInBackground(String... prams){
Toast.makeText(getApplicationContext(),
"Server too busy. Please try after sometime.",
Toast.LENGTH_LONG).show();}
出现错误。请帮忙。
最佳答案
您无法在 doInBackground 内更新 UI。执行此操作以显示 toast
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(),
"Server too busy. Please try after sometime.",
Toast.LENGTH_LONG).show();
}
});
它会解决你的问题
关于android - 如何在android中的asynctask中创建toast,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34433282/