I have an image url coming from my leisure API. Now I want to set it to an image when activity is loading. Below is how I get a bean from the rest of the api and then get the url from it.
Message message=new Message();
String imageUrl=message.getImageUrl();
I get a Message object from my database, and the image URL is included in this message object.
Then I used the Url object to get this image url.
URL url = null;
try {
url = new URL(imageUrl);
Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
contentImageView.setImageBitmap(bmp);
} catch (Exception e) {
e.printStackTrace();
}
I used the above codes to load an image into an image object, which is contentImageView.
But still I can’t upload this image to imageview, nothing is loading.
any ideas?