user3674194 user3674194 - 10 months ago 37
Android Question

Get Larger Image From Facebook Post?

I'm currently getting the newsfeed of a Facebook user. Currently, I can only retrieve thumbnail images that are associated with links, rather than the full-size image. Does anyone know how to get a larger image?

I've looked at the following posts and tried their solutions; however, the posts seem outdated and the facebook graph api seems to have changed since then:

Facebook Graph API Change: Picture type (size) no longer working?

Facebook API post: How to get larger thumbnail?

Please note that I'm on the me/home edge, so the answer below returns an error. See comments below.

my code is:

+ "name,object_id,picture,place,source,status_type,story,updated_time,type,status_type,story,to,type,"
+ "updated_time,with_tags");

Answer Source

Eventually I came to this solution:

1) find the URL of the larger image (see code below)

2) get bitmap from URL and add to application UI.

The code mentioned above:

private String getRealURL(String smallURL){
   if (smallURL.contains("url=http")){
       String[] pieces = smallURL.split("url=");
       pieces[1].replace("%2F", "//");
       pieces[1].replace("%3A", ":");
       Log.e("RealURL1:", pieces[1]);
       return pieces[1];           
       StringBuilder stringBuilder = new StringBuilder();
       Log.e("RealURL2:", stringBuilder.toString());
       return stringBuilder.toString();