androidfilekotlinzipandroid-internal-storage

Get file from zip in file Internal Storage directory using path


I want to load a File from the Internal Storage file directory. I try to specify the path in this way:

File("${context.filesDir.absolutePath}/zipfile.zip/name.png")

but I receive the error: No such file or directory.

There is a way to specify the path of name.png without unzipping it with ZipFile class?


Solution

  • There is a way to specify the path of name.png without unzipping it with ZipFile class?

    No, sorry. Android treats ZIP files fairly conventionally. If you want to access its contents, use ZipFile, ZipInputStream, or similar classes.