0

I can get Facebook profile images using

http://graph.facebook.com/<facebookId>/picture?type=square

but it redirects to

https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/t1.0-1/p50x50/XXX.jpg

How can I set new image url using Loopj's Android Smart Image View?

aikutto
  • 592
  • 2
  • 8
  • 22

1 Answers1

0

You can the direct url first using the following code :

public String GetDirectURL(String url_send) {

    URL url;
    URL secondURL = null;
    try {
        url = new URL(url_send);
        HttpURLConnection ucon = null;
        try {
            ucon = (HttpURLConnection) url.openConnection();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        ucon.setInstanceFollowRedirects(false);
        secondURL = new URL(ucon.getHeaderField("Location"));

    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return null;
    }
    return secondURL.toString();
}

and then assign the url returned to smart image view object ,but to not to be pixelated change type of image to large or xlarge

Bibo Wagdy
  • 46
  • 3