bitmap - Android 6 capture intent not writing file immediatly -


i'm developing app requires user take picture. create file saving image. call intent this:

if (takepictureintent.resolveactivity(getpackagemanager()) != null) {     // create file photo should go     file photofile = null;     try {         photofile = createimagefile();     } catch (ioexception ex) {         // error occurred while creating file         toast.maketext(formactivity.this, "no se pudo crear el archivo", toast.length_short).show();     }     // continue if file created     if (photofile != null) {         takepictureintent.putextra(mediastore.extra_output,             uri.fromfile(photofile));         startactivityforresult(takepictureintent, action_image_capture);     } } 

and then, want read file. this

bitmapfactory.options options = new bitmapfactory.options(); options.injustdecodebounds = false; options.inpreferredconfig = bitmap.config.rgb_565; options.indither = true; b = bitmapfactory.decodefile(new file(mcurrentphotopath).getabsolutepath(), options); 

this works nice in android 4 , 5. however, in android 6 bitmap null. think happens because when activityresult called, file has not been written yet. because bitmap loading code called onresume. , if lock device , unlock again, code works.

if add validation file size greater 0, code not executed in android 6. how can solve this?


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -