Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android, Make an image at a URL equal to ImageView's image

Tags:

android

I'm wondering how would I make an image that is located at a specific URL equal to an ImageView's image?

like image 245
Skizit Avatar asked Jun 25 '10 14:06

Skizit


People also ask

How will you load an image into an ImageView from an image URL using Picasso and display a custom image if there is an error while loading the image?

Image loading using Picasso is very easy, you can do it like this way Picasso. get(). load("http://i.imgur.com/DvpvklR.png").into(imageView); and in their website you can get every details. In your case you can parse every image URL and use RecyclerView to show them along with Picasso.


1 Answers

To download an image and set it as content for an imageview

try {   ImageView i = (ImageView)findViewById(R.id.image);   Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageUrl).getContent());   i.setImageBitmap(bitmap);  } catch (MalformedURLException e) {   e.printStackTrace(); } catch (IOException e) {   e.printStackTrace(); } 
like image 125
Primal Pappachan Avatar answered Sep 20 '22 15:09

Primal Pappachan