1

I am using holder to set images from Parse to my image view, below is following code

holder.rank.setText(worldpopulationlist.get(position).getRank());
holder.country.setText(worldpopulationlist.get(position).getCountry());
holder.population.setText(worldpopulationlist.get(position).getPopulation());
holder.flag.setImageResource(Integer.parseInt(worldpopulationlist.get(position).getFlag()));  

And below is the error given by android studio

java.lang.NumberFormatException: Invalid int: "http://listview123.herokuapp.com/parse/files/hlkhlkhyuiyemnbbmbackguyweuiyqw/10ad83c5546b993c18be84402e0f2bff_android_1.png"

James Z
  • 12,209
  • 10
  • 24
  • 44
Luther
  • 573
  • 1
  • 6
  • 16

2 Answers2

0

You can't just say "here is the url of the image, do something"

You have to download the image and set is as the wanted resource.

For a guide look here

Or if you want to use an external library you could, like Azmat said, use Picasso

Picasso.with(context).load(imageURL).into(myImageView);
Community
  • 1
  • 1
Malik
  • 878
  • 2
  • 9
  • 23
0

You can use Picasso to load images from link

Picasso.with(context).load(worldpopulationlist.get(position).getFlag()).into(holder.flag);

p.s: this code works if your worldpopulationlist.get(position).getFlag() returns link for file.