PTN
PTN

Reputation: 1692

Programmatically add ImageView and text to GridView

I'm display a list of items that has this same format (and I don't know how many of them):

Icon  SomeText  SomeText  SomeText
Icon  SomeText  SomeText  SomeText
...

I am using a GridView to display this so the list is scrollable.

I believe an ArrayAdapter would help me fill in the text fields.

But about the Icon fields, because they are .gif URLs, I am thinking about downloading the images first then put each one in an ImageView but I haven't figured out how do I programmatically do this.

Upvotes: 0

Views: 465

Answers (1)

pelotasplus
pelotasplus

Reputation: 10052

There are libraries for that, most notably Picasso by guys from square, and glide used in samples from Google.

Spend two minutes with google.com and found a tutorial for your https://futurestud.io/blog/picasso-adapter-use-for-listview-gridview-etc/

But then, you are using GIF files, so I guess you should us

Ion

as it supports GIF format.

So replace picasso used in tutorial with Ion and you should have what you want.

Upvotes: 2

Related Questions