Android : I would like to call a facebook profile image for the app user profile

Asked

Viewed 85 times

1

I’m having doubts about what code to use to call this image from the face profile, to my user profile, can anyone help me with that?

1 answer

1

It will depend a lot on the technology used for development, but basically you will have to use the Facebook API:

https://developers.facebook.com/docs/graph-api/reference/user/picture/

In the case of Android you have to implement something like:

/* faz a chamada REST */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{user-id}/picture",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* Trata o resultado lendo o objeto GraphResponse */
        }
    }
).executeAsync();
  • Got it, it’s for Android I’m developing, and I’m using the tool Android Studio, I’m beginner in this part of development, this call I make on my onCreate? Because I want to call this image anywhere in my app through its ID, would I have to use it on all my panels. java? or with "public void" I can make that call anywhere in my app?

  • you can create a public class with a method that runs this code snippet and use this class whenever you need it. Look for more complete examples on the Internet with an example design. I think it will help you more.

  • In a quick search I found this: http://www.cbsoft.dimap.ufrn.br/pdfs/Minicurso_2.pdf. is based on eclipse, but the source code is one only

  • Oh great, I’m reading the pdf, thank you very much, I think with this I can already advance my project, thank you very much Julio, hugs!

  • @Developmentdmidia, for nothing, if you have answered, please accept the answer

Browser other questions tagged

You are not signed in. Login or sign up in order to post.