How to get the user profile image in Android

android
image
user

#1

Hi all,

I am trying to get the current logged user’s avatar (image), but I do not know how to do it.

This solution seems no longer useful because it expects a Boolean in the third parameter of verifyCredentials:

TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient();
        twitterApiClient.getAccountService().verifyCredentials(true, false, new Callback<User>(){
            @Override
            public void failure(TwitterException e) {
            }

            @Override
            public void success(Result<User> userResult) {
                User user = userResult.data;
                twitterImage = user.profileImageUrl;
            }
        });

Thanks in advance.


#2

That is the old way used by Twitter Kit 1.x

    TwitterCore.getInstance().getApiClient().getAccountService().verifyCredentials(true, true, false).enqueue(new Callback<User>() {
        @Override
        public void success(Result<User> result) {
            
        }

        @Override
        public void failure(TwitterException exception) {

        }
    });

How to retweet tweet in Twitter Kit for Android