Answer the question
In order to leave comments, you need to log in
Using Retrofit2, I'm trying to get and display png. But it stubbornly throws NullPointerExeption?
What am I doing wrong, every time I try to display an image on the UI, I get NULLPOINTEREXCEPTION ?
Code in response
InputStream inputStream = response.body().byteStream();
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
imageView.setImageBitmap(bitmap);
Server: openresty/1.9.7.1
Date: Fri, 28 Aug 2020 14:03:29 GMT
Content-Type: image/png
Content-Length: 1869
Last-Modified: Mon, 24 Jun 2019 13:32:32 GMT
Connection: keep-alive
ETag: "5d10d0f0-74d"
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET
Access-Control-Allow-Headers: origin, content-type, accept
Expires: Fri, 04 Sep 2020 14:03:29 GMT
Cache-Control: max-age=604800
Accept-Ranges: bytes
D/OkHttp: <-- END HTTP (binary 1869-byte body omitted)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question