android - Getting images from gallery, some images doesn't show even image path is obtained -


i'm trying fetch images paths inside gallery(including subfolders) working fine, of images failing show thumbnails

*obtaining paths inside arraylist

    string[] projection = new string[]{             mediastore.images.imagecolumns._id,             mediastore.images.imagecolumns.data,             mediastore.images.imagecolumns.date_taken,     };     final cursor cursor = getactivity().getcontentresolver().query(             mediastore.images.media.external_content_uri, projection,             null, null,             mediastore.images.imagecolumns.date_taken + " desc");      if (cursor.movetofirst()) {         final string imagelocation = cursor.getstring(1);         locations.add(imagelocation);           while (cursor.movetonext()) {              string templocation = cursor.getstring(1);             boolean fileexists = new file(templocation).isfile();             if (fileexists) {                 locations.add(templocation);             }         }           cursor.close(); 

*setting image inside imageview

  uri uri = uri.fromfile(new file(mitems.get(position)));     picasso.with(getcontext())             .load(uri)             .resize(200, 200)             .centercrop()             .placeholder(r.drawable.placeholder_media)            .error(r.drawable.placeholder_error_media)             .nofade()             .into(mmediathumb); 

use :

picasso.with(context).setloggingenabled(true); 

to check if there error retrieving image in logcat.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -