android - Image captured from camera is empty in rare scenario -


sample part of code have used:

@override     public void onactivityresult(int requestcode, int resultcode, intent data) {         super.onactivityresult(requestcode, resultcode, data);          if (resultcode == activity.result_ok) {             if (requestcode == keys.camera_intent) {                 // image camera                 file f = new file(environment.getexternalstoragedirectory()                         .tostring());                 (file temp : f.listfiles()) {                     if (temp.getname().equals(refimage)) {                         f = temp;                         break;                     }                 }                  listofimages.add(f.tostring());                  try {                     displaycapturedimagesfromcamera();                 } catch (exception e) {                     e.printstacktrace();                 }             } else if (requestcode == 2) {                 // image gallery              }         }     } 

what happening:

  1. sometimes blank image(nothing there in image , place holder created). when use camera above code

what trying do:

  1. is there way check file has image data in before setting image location

  2. something read contents of file image data

depending on android device , manufacturer android version , camera app using, camera intent needs implemented differently. check out https://github.com/ralfgehrer/androidcamerautil, in particular cameraintenthelperactivity.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -