如您所见,我想在ImageView中显示Facebook个人资料图片,但不幸的是,图片URL无法正常工作。
public void onCompleted(JSONObject object, GraphResponse response) {
Log.d("demo",object.toString());
try {
String name = object.getString("name");
String id = object.getString("id");
tvText.setText(name);
String imageURL = "https://graph.facbook.com/"+ id + "/picture type=small";
Glide.with(MainActivity.this).load(imageURL).error(R.drawable.com_facebook_button_icon).into(tvImg);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
Bundle bundle = new Bundle();
bundle.putString("fields","name,id,first_name,last_name");
graphRequest.setParameters(bundle);
graphRequest.executeAsync();
您的网址字符串不正确。
只要更换这个
String imageURL = "https://graph.facbook.com/"+ id + "/picture type=small";
对此
String imageURL = "https://graph.facebook.com/"+ id + "/picture type=small";
“ facebook”中缺少“ e”。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句