在这段代码中我得到了null-value
bitmap
如何解决这个错误,并且后执行方法位图也是null,所以请帮我获取位图的正确值。我正在使用解析此应用程序
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog.show();
}
@Override
protected Bitmap doInBackground(String... params) {
try {
return Picasso.with(context).load(params[0]).get();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
try {
if(bitmap==null)
{
Toast.makeText(context,"bitmap null",Toast.LENGTH_SHORT);
}
this.imageSaveListener.onImageSaved(bitmap);
}catch (Exception e){
Log.d(TAG, "Error saving file: " + e.getMessage());
}
}
public void hideProgressDialog(){
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
}
}
public interface ImageSaveListener {
void onImageSaved(Bitmap downloadImageBitmap);
}