2017-01-01 8 views
0

SD-CARDに保存されている画像を画像ビューに貼り付けようとしていますが、setImageBitmapで画像を表示できますが、表示しないPicasso画像Andorid PicassoさんはSDCARDの画像を表示しません

final File imageFile = new File(APP.DIR_APP + APP.IMAGE + "/" + channel.get(position).getFileName()); 
    if (imageFile.isFile() && imageFile.exists()) { 
     BitmapFactory.Options options = new BitmapFactory.Options(); 
     //options.inSampleSize = 8; 
     //holder.post_image.setImageBitmap(BitmapFactory.decodeFile(imageFile.getAbsolutePath(), options)); 
     Picasso.with(context).load(imageFile).into(holder.post_image); 
    } 
+0

これを参照してください:http://stackoverflow.com/a/24097624/5425930 –

+0

Picasso.with(context).load(Uri.parse(imageFile).toString ())。into(holder.post_image); ' – Enzokie

+0

画像サイズが本当に大きかったら、ピカソが失敗したときも同様の状況でした。私にとって、解決策はGlideに移行することでした。 –

答えて

0

私のコードは正しいですが、wrap_content fまたはImageViewの幅と高さ、画像が表示されません。

0
  1. はあなたのimageFileパスをログに記録し、それを確認してください。
  2. あなたはすべてがOKであれば、にあなたのコードをchanege Picasso.with(context)
  3. に渡しているcontext確認:あなたがいない場合は、READ権限を追加した場合

    if (imageFile.isFile() && imageFile.exists()) { 
        Picasso.with(context).load(Uri.fromFile(imageFile)).into(holder.post_image); 
    } 
    
1

チェックこの行をマニフェストファイルに追加してください

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 
+0

のアプリケーションにこの許可があることを示すことができません –

関連する問題