unable to pass null to execute(); method of AsyncTask in android 4.0

好久不见. 提交于 2019-12-21 07:25:14

问题


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 {

        }
    }

}

}

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


回答1:


This should work:

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


来源:https://stackoverflow.com/questions/10679739/unable-to-pass-null-to-execute-method-of-asynctask-in-android-4-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!