无法将null传递给execute(); android 4.0中AsyncTask的方法 [英] unable to pass null to execute(); method of AsyncTask in android 4.0

查看:71
本文介绍了无法将null传递给execute(); android 4.0中AsyncTask的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将null值传递给execute(); android 4.0中的AsyncTask方法显示错误 该方法execute(Integer [])对于该类型是模棱两可的",但相同的代码在android 2.2上也可以正常工作.代码为:

i am trying to pass null value to execute(); method of AsyncTask in android 4.0 it show error "The method execute(Integer[]) is ambiguous for the type" but same code is work fine with android 2.2 Code is :

public class AllianceAnalysisDemoActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    new AsynPageLoader().execute(null);
}


public class AsynPageLoader extends AsyncTask<Integer, Integer, Bitmap> {

    @Override
    protected void onPreExecute() {
        // progressBar.setVisibility(VISIBLE);
    }

    @Override
    protected Bitmap doInBackground(Integer... params) {

        return null;
    }

    @Override
    protected void onPostExecute(Bitmap result) {
        if (result != null && result.getHeight() > 0
                && result.getWidth() > 0) {

        }else {

        }
    }

}

}

请帮助我如何传递null值.execute(null); android 4.0中的方法

please help me how to pass null value .execute(null); method in android 4.0

推荐答案

这应该有效:

new AsynPageLoader().execute((Integer) null);

这篇关于无法将null传递给execute(); android 4.0中AsyncTask的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆