我正在尝试为我的活动实现Tab View.我收到一个错误.
java.lang.IllegalArgumentException:您必须指定一种创建选项卡指示符的方法
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, MonthActivity.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("Month")
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the …
Run Code Online (Sandbox Code Playgroud) 我想提取一个普通的zip文件,但它仍然失败.这是我现在使用的代码:
private File downloadPath = new File(Environment.getExternalStorageDirectory() + "/Test/file.zip");
private File unzipLoc = new File(Environment.getExternalStorageDirectory() + "/Test/");
FileInputStream fin = new FileInputStream(downloadPath);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry ze = null;
while ((ze = zin.getNextEntry()) != null)
{
FileOutputStream fout = new FileOutputStream(unzipLoc + ze.getName());
for (int c = zin.read(); c != -1; c = zin.read())
{
fout.write(c);
}
zin.closeEntry();
fout.close();
}
zin.close();
Run Code Online (Sandbox Code Playgroud)
它在'zin.getNextEntry()'部分失败.错误:java.util.zip.ZipException:无法读取版本任何想法?谢谢!