Warm tip: This article is reproduced from serverfault.com, please click

How to share a profile picture and get it in my chat app?

发布于 2014-08-08 22:14:51

I made a chat application, it works fine, but I want to add a profile section, in this section the users can change their avatars (The avatar was a default picture) for any picture in gallery... at this point my app works well, the user can change avatar and it is show in the chat picture (like facebook).. but this is only local...

My question was:

What can I do to get all my contacts profile pictures?

EDITED

Hi I made a server and I connected my app to it, I'm able to upload pictures, when a user upload a picture my app rename the picture with an unique value, my new questions are...

What do I need to do to be able to see my contacts profile pictures? I need to download my contacts pictures to a temp folder? I'm lost here.

Questioner
Eilean Laborde
Viewed
0
2017-05-23 19:57:12

Once you're able to request images from your server, you will have to download and display them. There are a variety of ways you can do this, the simplest using an AsyncTask to download in the background. See this StackOverflow question for a tutorial.

Another option is to use a third party library - I've had success with Universal Image Loader in several projects. It handles asynchronous downloading, caching and displaying of images. Once you've set it up, loading an image is simple:

imageLoader.displayImage("http://image-url.jpg", imageView);