2013-01-10 30 views
1

我想從我的aplication打開一個壓縮文件,但它並不適用如何從android活動打開zip文件?

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

我已經嘗試過像其他選項:

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); 

但它不」 t也可以工作。

將帖子

如果我的WinZip已經安裝在手機應用程序,我的應用程序調用的WinZip應用程序,並打開壓縮包,但我真正需要的是在我的本地應用程序

+1

「它不起作用」是對您的症狀的無用描述。 – CommonsWare

回答

3

用來打開它ZipFile如果你想從一個zip文件讀取。 Android API對ZIP格式有很好的支持。

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