机器人让所有用户的好友资料图片quicly [英] android getting all user's friend profile pictures quicly

查看:80
本文介绍了机器人让所有用户的好友资料图片quicly的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在找我所有的朋友的个人资料图片的快捷方式。 我使用的是Facebook的SDK为Android。

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

现在,我让我的好友列表JSON对象,并与正在运行的for循环这个对象内部。 http://graph.facebook.com:在环我是从把每个图像中的可绘制对象/ UID /图片

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.

我见过的每一个画面体重只有4K,它去得快的几个朋友。 但如果我有1000个朋友和我连接到Facebook以寻求他们每个人? 这将需要大量的时间。

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 ?

推荐答案

如果每一个画面是4K,你有1000的朋友,这是约4MB的数据。这将需要时间来下载。有没有办法解决它,如果你需要的是他们的照片。

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.

这就是说,你应该想想你是否真的需要他们所有的照片与否。应用程序的绝大部分将使用朋友的个人资料图片显示给用户。合理地讲,该接口是不会显示1000的朋友的一次。在这种情况下,一个很好的解决方案可能是延迟加载的图像,也就是当你解析JSON为每个朋友存储图像的URL,但不下载实际的图像,直到你需要他们。如果说你的界面显示10位朋友的一次,那么这只是图像的40K是一大堆更合理。

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.

您可以搜索计算器为Android延迟加载列表中的图像,但这里的是可能会用一个特定的主题:<一href="http://stackoverflow.com/questions/541966/android-how-do-i-do-a-lazy-load-of-images-in-listview">Android - 如何做我做的一个图像延迟加载ListView中

You can search StackOverflow for android lazy load list images but here's one particular thread that may come useful: Android - How do I do a lazy load of images in ListView.

这篇关于机器人让所有用户的好友资料图片quicly的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆