Android external sdCard DCIM folder path

前端 未结 3 643
花落未央
花落未央 2020-12-20 23:20

I need the DCIM folder path from the external sdCard if it is present. I have observed that this path changes according to the manufacturer of the device (\"/storage/e

3条回答
  •  爱一瞬间的悲伤
    2020-12-20 23:41

    The answer is here in the API Guide: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

    The basic steps are: 1. Check the storage state (if it exists) 2. Get the storage Path 3. Go further in a directory you want 4. Make a folder, read a file, write a file, etc. That part is up to you.

    This is taken from the docs:

    public File getAlbumStorageDir(String albumName) {
        // Get the directory for the user's public pictures directory.
        File file = new File(Environment.getExternalStoragePublicDirectory(
                Environment.DIRECTORY_PICTURES), albumName);
        if (!file.mkdirs()) {
            Log.e(LOG_TAG, "Directory not created");
        }
        return file;
    }
    

提交回复
热议问题