5
Currently I have an application running on 100 phones with android 2.3(established by the client), but are changing the phones to 4.4 and use the sd card
to store and then display as product listing.
The problem is in Android 4.4 I can’t create folders inside the sd card
, I currently use the following code for checking and creating the folder.
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
{
file = new File(Environment.getExternalStorageDirectory() + File.separator + "imagem");
file.mkdirs();
if (file.isDirectory())
{
//metodos que fazem pesquisa de imagens omitidos
}
path returned by the above methods on Android 2.3:
/mnt/sdcard/image
path returned by the above methods on Android 4.4 it lists as "Created" but does not create:
/Storage/Emulated/0/image
I looked at the documentation and got no results, changed the way of access between versions?
The AndroidManifest.xml
you are already allowed to read and write to sdcard.
I can use in previous versions too?
– Wellington Avelino
In that case use ContextCompat.getExternalFilesDirs that works in all versions.
– ramaral
I created a test project worked perfectly.
– Wellington Avelino