Search code examples
android-studiofacebook-graph-apipicassoandroid-glide

Facebook profile Picture not showing in android studio, I used glide and Picasso both


As you see I want to show a Facebook profile picture in ImageView but unfortunately, the image URL is not working.

                    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();
      

Solution

  • Your URL String is incorrect.

    Just replace this

    String imageURL = "https://graph.facbook.com/"+ id + "/picture type=small";
    

    to this

    String imageURL = "https://graph.facebook.com/"+ id + "/picture type=small";
    

    There was a missing "e" in the "facebook".