2

I'm looking for a quick way of getting all my friends's profile pictures. I'm using the Facebook SDK for Android.

right now I'm getting my friend's list JSON object and running with a for loop inside this object. in the loop i'm putting each image in a Drawable object from the: http://graph.facebook.com/uid/picture.

I've seen that each picture weight only 4K and it goes fast for few friends. but what if I have 1000 friends and i'm connecting to facebook for each one of them? it will take lots of time.

I've seen in other application that some of them show all your friend real quick.

what is the best way of doing it? using the runner?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Asaf Nevo
  • 11,338
  • 23
  • 79
  • 154

1 Answers1

4

If each picture is 4K and you have 1000 friends, that's approximately 4MB of data. It'll take time to download it. There's no way around it if you need all of their pictures.

That said, you should think about whether you really need all of their pictures or not. The vast majority of apps will use the profile pictures of friends to display to the user. Reasonably speaking, the interface is not going to display 1000 friends all at once. A good solution in this case might be to lazy load the images, i.e. store the URL of the image when you parse the JSON for each friend, but don't download the actual images until you need them. If say your interface shows 10 friends at once, then that's only 40K of images which is a whole lot more reasonable.

You can search StackOverflow for android lazy load list images but here's one particular thread that may come useful: Lazy load of images in ListView.

Community
  • 1
  • 1
kabuko
  • 36,028
  • 10
  • 80
  • 93