Android的,的AsyncTask,onProgressUpdate和onPostExecute不会被调用 [英] Android, AsyncTask, onProgressUpdate and onPostExecute not being called
问题描述
在 doInBackground
完成它做什么, onPostExecute
不会被调用。如果我尝试发布一个进步, onProgressUpdate
不会被调用了。
我重新什么也不做的背景,但记录的文本和AsyncTask的但两种方法都不会被调用。
下面是我的code
公共类MyAsyncTask扩展的AsyncTask<对象,整数,太虚> {
@覆盖
保护无效doInBackground(对象... PARAMS){
Log.d(MyAsyncTask,doInBackground);
publishProgress(1);
返回null;
}
@覆盖
保护无效onPostExecute(无效的结果){
Log.d(MyAsyncTask,onPostExecute);
super.onPostExecute(结果);
}
@覆盖
保护无效onProgressUpdate(整数...值){
Log.d(MyAsyncTask,onProgressUpdate);
super.onProgressUpdate(值);
}}
和这里是我称之为
新MyAsyncTask()执行()。
我是用一连串的jar的项目,并通过删除并重新将其添加到项目中,每一件事精细的工作......我不知道知道为什么,但是这就是解决了这个问题对我来说。
After doInBackground
finishes what it does, onPostExecute
not get called. and if I try to publish a progress, onProgressUpdate
not get called too.
I recreated an asyncTask that does nothing in the background but logging a text and yet both methods not get called.
Here is my code
public class MyAsyncTask extends AsyncTask<Object, Integer, Void> {
@Override
protected Void doInBackground(Object... params) {
Log.d("MyAsyncTask","doInBackground");
publishProgress(1);
return null;
}
@Override
protected void onPostExecute(Void result) {
Log.d("MyAsyncTask","onPostExecute");
super.onPostExecute(result);
}
@Override
protected void onProgressUpdate(Integer... values) {
Log.d("MyAsyncTask","onProgressUpdate");
super.onProgressUpdate(values);
}}
and here is how I call it
new MyAsyncTask().execute();
I was using flurry jar in the project, and by removing it and re-adding it to the project, every thing worked fine... I don't know why but that's what solved it for me.
这篇关于Android的,的AsyncTask,onProgressUpdate和onPostExecute不会被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!