2017-10-22 9 views
1

picassoを使用してログインしたユーザーのプロフィール画像を表示するようにアプリを取得しようとしていますが、profile.getPhotoUrl()の方法で生成されたURLがプロフィール画像に表示されませんが、表示されない画像を表示します。
私はいくつかの調査を行い、なぜそれが表示されないのかは、それがcontentProvider uriであることに気づきました。
プロフィール画像を表示するにはどうすればよいですか?picassoを使用してURIの画像を表示するにはどうすればよいですか?画像が表示されない

Hereは、プロファイルのURIはどのようなものになるかです:

if (user != null) { 
    for (UserInfo profile : user.getProviderData()) { 
     // Id of the provider (ex: google.com) 
     String providerId = profile.getProviderId(); 

     // this displays the email for some reason 
     String uid = profile.getUid(); 

     //displays the name 
     String name = profile.getDisplayName(); 
     //doesnt even display the email for some reason 
     String email = profile.getEmail(); 
     //profile pic uri 
     Uri photoUrl = profile.getPhotoUrl(); 

     displayUser.setText(uid); 
     displayName.setText(name); 
     displayPhotoUrl.setText(photoUrl.toString()); 

     Picasso.with(getApplicationContext()) 
       .load(photoUrl) 
       .into(pic); 
    }; 
} 
+0

これは、古いイメージを新しいイメージで置き換え続けます。あなたは毎回同じ画像のImageViewを使用しています。 –

+1

'callback'を使用して問題が' Picasso'であった場合にエラーを見てください – MHSFisher

答えて

0
Picasso.with(getActivity()).load(uri).into(imageView); 

OR

File f = new File(uri); 
Picasso.with(getActivity()).load(f).into(imageView); 
0

ウリからのパスを取得し、それにFileオブジェクトを作成します。

File file=new File(uri.getPath()); 
Picasso.with(getActivity()).load(file).into(imageView); 
関連する問題