How to get profile picture in android using Twitter kit,

前端 未结 4 2070
栀梦
栀梦 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:38

    As of Nov 2016. This works. There is a change in the implementation of verify credentials.

    Call user = TwitterCore.getInstance().getApiClient().getAccountService().verifyCredentials(false, false);
               user.enqueue(new Callback() {
                           @Override
                            public void success(Result userResult) {
                                String name = userResult.data.name;
                                String email = userResult.data.email;
    
                                // _normal (48x48px) | _bigger (73x73px) | _mini (24x24px)
                                String photoUrlNormalSize   = userResult.data.profileImageUrl;
                                String photoUrlBiggerSize   = userResult.data.profileImageUrl.replace("_normal", "_bigger");
                                String photoUrlMiniSize     = userResult.data.profileImageUrl.replace("_normal", "_mini");
                                String photoUrlOriginalSize = userResult.data.profileImageUrl.replace("_normal", "");
                            }
    
                            @Override
                            public void failure(TwitterException exc) {
                                Log.d("TwitterKit", "Verify Credentials Failure", exc);
                            }
                        });
    

提交回复
热议问题