Android: Use Glide To Load Facebook Photo Url
I'm building an Android app in which I'm trying to let the user bring in photos from Facebook. After I grab the URLs from a GraphRequest, I'm trying to use Glide to load the image
Solution 1:
I was able to solve the problem by switching photos{link}
to photos{source}
which returns the actual source URLs. Here's the revised code:
GraphRequest request = GraphRequest.newMeRequest(
AccessToken.getCurrentAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject object, GraphResponse response) {
try {
String url = object.getJSONObject("photos").getJSONArray("data").getJSONObject(0).getString("source");
Glide.with(UserSettingsActivity.this).load(url).into(userOne);
} catch (Exception e) {
e.printStackTrace();
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields","id,photos{source}");
request.setParameters(parameters);
request.executeAsync();
Post a Comment for "Android: Use Glide To Load Facebook Photo Url"