Victor Laerte
Victor Laerte

Reputation: 6556

How can I open a zip file from an android activity?

I'm trying to open a zip file from my aplication, but it doesn't works

Uri uri = Uri.parse("file:///mtn/sdcard/download/teste.zip"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it);

I've already tried other options like:

File file = new File("mnt/sdcard/download/teste.zip");
            Intent it = new Intent();
            it.setAction(android.content.Intent.ACTION_VIEW);
            it.setDataAndType(Uri.fromFile(file), "application/zip");
                startActivity(it);

But it doesn't works either.

[EDITED]

If I've winzip app already installed in phone, my app calls winzip app and open the archive, but what I actually need is to open it in my native application

Upvotes: 1

Views: 1288

Answers (1)

Audrius Meškauskas
Audrius Meškauskas

Reputation: 21778

Use ZipFile if you want to read from a zip file. Android API has its own quite good support for ZIP format.

ZipFile z = new ZipFile("/mtn/sdcard/download/teste.zip");

Upvotes: 3

Related Questions