android getting all user's friend profile pictures quickly - android

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?

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.

Related

Firebase Data Loading Speed

I'm developing an android app using Firebase back-end. Everything works fine, I have no problem whatsoever. The only problem is that, the data loading speed. Because it's a cloud-based system, sometimes it takes 4-5 (or even longer) seconds to load a user profile picture or simply to pull username from the database to display user. Now, you might say, well we don't even know how your data structure is stored in the no-SQL table but really I can't go wrong with that. I just structured it in a way that it's just a simple one read query. Or is it normal? Maybe Firebase loads data with some delay.
How you as other developers, get over this loading time? For example, I have a user picture, where the pic should be loaded from the Firebase database, but till pic is loaded, the image-view is just staying as a black view.
All of this depends on several factors that you can check.
Internet speed
Programming type
The size of the files (you probably need a lot of time to load for a
high volume file)
And another solution is to store the information you've previously received into the phone's memory(cache).

Mobile Application Development using Android

I am developing an android application in which when a user logins through facebook his profile picture gets stored. Then the user is shown the profile pictures of his fb friends who have installed the app, one by one. First, one friend's pic is shown then on click of next button, next friend's pic is shown. This continues till all the friends images have been shown to the user or user has skipped the section.
First, I thought of storing all the images in my database and then retrieve them one by one as the user presses the next button. But doing so will render very slow performance as for every time an image has to be shown to the user I have to hit the db.
The alternative is to store images in my local drive and store every image's location in the db.
Please elaborate on how this could be achieved and the performance issues in this case considering a large user base?
Also suggest any other way of achieving the aim, if you may.
I am using WAMP for the purpose.
Thanks in advance.
The pictures are stored in the apps cache after they are downloaded.
When the user logs in to fb for the 1st time it will download the images.
2nd time it will get them from cache unless its a new image.
clear the cache when it gets to a certain MB limit and keep it small
I suggest using Google Volley library to get images from the net as when setup properly you can expire / clear images from the cache.
The are are other libraries for image loading and handling to consider such as Universal Image loader and Picasso but Volley can also be used for fetching Data from the Net.

What is the best way to save images in Parse?

What am I trying to achieve: Based on some filters by the app user, I want to return a list with text and images.
How am I doing it: I have created a table in Parse and have added a column with object type as 'file'. I have put all the jpg/gif images into that column. (double-click, browse, select image from local computer).
The trouble I am having is, the list takes considerable time (~7 seconds) before it is displayed on my android app.
Is there a better way of handling image data within Parse or should I store images somewhere else (like Amazon S3)?
I am using standard queries for Parse in order to get data, nevertheless, am also checking if there is any code latency. Wanted to confirm if I am correctly handling the image data for back-end or not.
Is there a better way of handling image data within Parse or should I
store images somewhere else (like Amazon S3)?
If your images is not too much or you are using for example(five image) its better to save the into the Assets or Drawable Folder for loading.
and if i correctly knows about this problem, you need to use ProgressBar and one image, before loading the Images in Internet.
Caching images and displaying
Hope this helps.
I am using Parse to store images too, but it's not slow as you said. Since Parse is part of Facebook, I think their infrastructure is the same. There are possible issues:
Internet connection: Slow or on 3G?
Images: files are big?
Let me know which case you are in.
If you just display thumbnail images, I suggest you to process it before saving to Parse by writing Cloud function as describe on their blog. The you just need to use generated thumbnails on your listview/gridview

Android - How to load thumbnails of facebook photos?

I'd like to ask if there is any way to request only small-sized thumbnails of photos from facebook albums. My vision is to create an icon for every user's album that will consist from 3 overlapping photos, something like this..
..and I don't wanna wait until all large images are downloaded. Of course downloading will not run in UI thread, but still.
It is described here: https://developers.facebook.com/docs/graph-api/reference/v2.1/album/picture
There are examples for several platforms/langs

Images, Caching and Sprites in Android

I've got a really simple (so far) Android app, which basically shows your friends on a Google Map. Think Latitude.
The friends are represented as avatar pins, the images of which are downloaded from the internet.
When a "friend" is added, i fetch the avatar in a background thread. I then don't need to download the avatar again (i'll probably check for updates during app start, but not too fussed about that right now). The actual images will most likely come from a social network (Facebook, Google, Twitter, Gravatar, etc)
Now, the map view will basically always be displayed, so the images are essentially always present. I will however be performing image manupilation, stacking, etc for these avatars.
Given the above information, here are my questions:
Where should i cache these images? Looking at the docs, i feel like a Disk Cache would be the best option?
Should i think about creating an image sprite? Remember, these images don't live in the APK/resources, they are dynamically fetched. Perhaps i could create a per-friend sprite with all the different image sizes i will require?
I also have access to the server which returns these images (right now they just return a URL) - so should i enable this server to instead do image processing/resizing etc based on my requirements, or simply download the original image and then perform the processing on my client application?
You can use lazy loading to dynamically download the users images from the URl and store it in cache. I believe this link would help you out in this :
https://github.com/thest1/LazyList

Categories

Resources