我正在尝试将null值传递给execute(); android 4.0中的AsyncTask方法显示错误 “方法execute(Integer [])对于类型”是不明确的“但相同的代码与android 2.2代码工作正常:
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 {
}
}
}
}
请帮我如何传递空值.execute(null); android 4.0中的方法
答案 0 :(得分:20)
这应该有效:
new AsynPageLoader().execute((Integer) null);