很抱歉重新发布这个问题,但我使用这种方法出现错误,我无法弄清楚我做错了什么。
mPlayersClient = Games.getPlayersClient(this, googleSignInAccount);
mPlayersClient.getCurrentPlayer()
.addOnCompleteListener(new OnCompleteListener<Player>() {
@Override
public void onComplete(@NonNull Task<Player> task) {
String displayName;
Log.i("playerId" , task.getResult().getPlayerId());
if (task.isSuccessful()) {
displayName = task.getResult().getDisplayName();
Uri uri = task.getResult().getIconImageUri();
Log.i("url", uri.toString());
CircleImageView imageView = findViewById(R.id.testImage);
//ERROR : here when i use "this" it gets red underline
ImageManager manager = ImageManager.create(this);
manager.loadImage(imageView, uri, R.drawable.defualt_user_img);
}
uri 是内容方案,所以我不能使用 Picasso。当我将光标悬停在“this”上时,它显示
ImageManager 中创建(android.content.Context)不能应用到(匿名com.google.android.gms.tasks.OnCompleteListener)