How to get profile picture in android using Twitter kit,

前端 未结 4 2071
栀梦
栀梦 2021-02-15 18:12

I\'m trying to implement a simple application that uses Twitter kit. The problem is that i\'m not able to get the profile picture.Any help would be appreciated.

Thanks<

4条回答
  •  广开言路
    2021-02-15 18:20

    Found the answer.

    There is a callback which returns you the User object.

    TwitterCore.getInstance().getApiClient().getAccountService().verifyCredentials(true, true, false).enqueue(new Callback() {
        @Override
        public void success(Result result) {
    
        }
    
        @Override
        public void failure(TwitterException exception) {
    
        }
    });
    

    On the success branch, you can get the User object by calling:

    User user = userResult.data;
    

    And from this object you can get all the information form the user. For the profile image:

    String profileImage = user.profileImageUrl;
    

提交回复
热议问题