Here my requirement is, I need to download the bitmap from URL by using Retrofit and need to set to Notification Icon.I tried but i am getting null pointer exception.I dont want to download it to any file or folder. directly i want to use the return bitmap to notification icon. Pls help where i was wrong

My Code:

```
if (photourl != null) {
if ((photourl.endsWith(".jpg") || photourl.endsWith(".png") || photourl.endsWith(".jpeg") )) {
    if(messageType!=6 && messageType!=7){
      RoundCornerImg RCIMG = new RoundCornerImg();
      bm = RCIMG.getRoundedRectBitmap(getImageBitmap(photourl), 10);

     }else{
       bm = getImageBitmap(photourl);
       }
      photo_flag = true;
       }
  }

```

Get Image Bitmap Method:

```
 private Bitmap getImageBitmap(String url) {

        Call<ResponseBody> call=RetroApiCall.getNotificationImage(url);

        call.enqueue(new Callback<ResponseBody>() {
            @Override
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                if (response.isSuccessful()) {
                     bitmap =BitmapFactory.decodeStream(response.body().byteStream());
                }else{
                    bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
                    if (Build.VERSION.SDK_INT >= 20) {
                        bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.notification);
                    }
                }
            }

            @Override
            public void onFailure(Call<ResponseBody> call, Throwable t) {

            }
        });

    return bitmap;
}

```

Thanks!