File length is 0 when recreating file from URI, or original filepath [getExternalFilesDir(String type) vs getFilesDir()]

前端 未结 3 631
慢半拍i
慢半拍i 2021-01-14 02:09

A little bit of background first: this app takes a picture and uploads to an Azure blob storage.

The picture is stored in a file (internal storage) using getA

3条回答
  •  感情败类
    2021-01-14 02:41

    Even though I don't have all the information, I'm gonna make the call that the file is missing from the path you've given. The javadoc for length() specifically mentions this case will return 0.

    So try checking exists() before you do anything with the file.

提交回复
热议问题