onProgressUpdate()从来没有被调用过,你能告诉我为什么吗?
private class LoginMe extends AsyncTask<Context,Void,Boolean> { @Override protected Boolean doInBackground(Context... arg0) { doSomething(); return true; } @Override protected void onProgressUpdate(Void... v) { super.onProgressUpdate(v); Log.d("Dev","Im in onProgressUpdate()"); } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); if (result) { doOne(); } else { doTwo(); } } }
解决方法
您必须手动从doInBackground中调用publishProgress.
doInBackground(Params…),invoked on
the background thread immediately
after onPreExecute() finishes
executing. … This step can also use
publishProgress(Progress…) to
publish one or more units of progress.
These values are published on the UI
thread,in the
onProgressUpdate(Progress…) step.
http://developer.android.com/reference/android/os/AsyncTask.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。