Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6155569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:27:27+00:00 2026-05-23T20:27:27+00:00

I have android application in which for a logged facebook user to retrieve in

  • 0

I have android application in which for a logged facebook user to retrieve in your android application all his friends in a similiar way with this picture:
http://i55.tinypic.com/wv9vzb.png (this is taken from iphone but I want something similar to this).

I’ve integrated facebook into my application using facebook-sdk.

If someone could point me into the right direction I would be gratefull.Thanks!

UPDATE:

I tried loading the URL with your code :

    Bitmap bitmap=null;
    Log.d("We are:","Loading Picture");
    imageURL = "http://graph.facebook.com/"+userID+"/picture?type=small";

    try{
        bitmap=BitmapFactory.decodeStream((InputStream)new URL(imageURL).getContent());
    }catch(Exception e){

        Log.d("And:","Loading Picture FAILED");
        e.printStackTrace();
}

And the logcat looks like this:

java.net.SocketTimeoutException: The operation timed out
     at org.apache.harmony.luni.platform.OSNetworkSystem.receiveStreamImpl(Native Method)
     at org.apache.harmony.luni.platform.OSNetworkSystem.receiveStream(OSNetworkSystem.java:478)
    at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:565)
    at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:61)
   at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.readln(HttpURLConnection.java:1178)
  at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.readServerResponse(HttpURLConnection.java:1250)
    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.sendRequest(HttpURLConnection.java:1238)
     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequestInternal(HttpURLConnection.java:1558)
    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequest(HttpURLConnection.java:1551)
     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1052)
     at java.net.URLConnection$DefaultContentHandler.getContent(URLConnection.java:1053)
    at java.net.URLConnection.getContent(URLConnection.java:166)
    at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.getContent(HttpsURLConnection.java:156)
   at java.net.URL.getContent(URL.java:621)
    at com.facebook.android.Example.getUserPic(Example.java:192)
    at com.facebook.android.Example$2.onClick(Example.java:174)
     at android.view.View.performClick(View.java:2364)
    at android.view.View.onTouchEvent(View.java:4179)
     at android.widget.TextView.onTouchEvent(TextView.java:6540)
     at android.view.View.dispatchTouchEvent(View.java:3709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)

I must say that when I type the URL in the browser it shows me the correct profile picture.

I tried also to load the URL by doing a http post:

 HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost=new HttpPost(imageURL);

        try{

        HttpResponse response = httpclient.execute(httppost);

        if(response!=null)
        {
        bitmap=BitmapFactory.decodeStream(response.getEntity().getContent());

            }
       }
        catch(ClientProtocolException e)
        {
            e.printStackTrace();
        }
        catch(IOException e)
        {
            e.printStackTrace();
        }

And the logcat looks like this:

Uncaught handler: thread main exiting due to uncaught exception
java.lang.IllegalArgumentException: Host name may not be null
   at org.apache.http.HttpHost.<init>(HttpHost.java:83)
   at org.apache.http.impl.client.AbstractHttpClient.determineTarget(AbstractHttpClient.java:497)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
  at com.facebook.android.Example.getUserPic(Example.java:203)
   at com.facebook.android.Example$2.onClick(Example.java:174)
     at android.view.View.performClick(View.java:2364)
    at android.view.View.onTouchEvent(View.java:4179)
     at android.widget.TextView.onTouchEvent(TextView.java:6540)
     at android.view.View.dispatchTouchEvent(View.java:3709)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)

What’s wrong?:-S

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:27:28+00:00Added an answer on May 23, 2026 at 8:27 pm

    You would need to get the users friends by making a request to the graph api (https://graph.facebook.com/me/friends?) this will return all the data in a JSON-encoded array.

    You can then create a list of all the friends and download the pictures using the ids and the url "http://graph.facebook.com/"+userID+"/picture?type=small"

    For an example project whichs shows you how to create a list with images downloaded from a url take a look at my answer to this question here.

    Hope this helps to get you started!


    Here is the code i use to download the users photo, it will return a bitmap that you can then set in an image view by calling imageView.setImageBitmap(bitmap);

    /**
     * Function loads the users facebook profile pic
     * 
     * @param userID
     */
    public Bitmap getUserPic(String userID) {
        String imageURL;
        Bitmap bitmap = null;
        Log.d(TAG, "Loading Picture");
        imageURL = "http://graph.facebook.com/"+userID+"/picture?type=small";
        try {
            bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageURL).getContent());
        } catch (Exception e) {
            Log.d(TAG, "Loading Picture FAILED");
            e.printStackTrace();
        }
        return bitmap;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an android application in which if user changes his/her system font through
I have an Android Application which uses JNI calls. Now i want this application
I have an Android application which, among other things, also publishes updates on Facebook.
I have an android application which allows the user to take a picture using
Hi i have develop an android application in which i want to prevent user
I have an Android application that connects to Facebook to request authorization of an
I have a Web Service and an Android application that uses this web service.
I have an Android application which grabs some data from an external XML source.
I have a android application which needs username and password to login. I need
I have an Android application from which I want to upload some data to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.