Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 解压时的进度条_Java_Android - Fatal编程技术网

Java 解压时的进度条

Java 解压时的进度条,java,android,Java,Android,在我的应用程序中,它需要解压缩一个压缩的文件夹。在我的代码中,它无法添加一个带有它的progressbar。所以我在谷歌上搜索并在stackoverflow中找到了一个已回答的问题 (复印件) 私有类解压缩扩展异步任务{ 私有字符串_zipFile; 私有字符串_位置; 私人int per=0; 公共解压缩(字符串zipFile、字符串位置){ _zipFile=zipFile; _位置=位置; _dirChecker(“”); } 受保护整数doInBackground(){ 试试{

在我的应用程序中,它需要解压缩一个压缩的文件夹。在我的代码中,它无法添加一个带有它的progressbar。所以我在谷歌上搜索并在stackoverflow中找到了一个已回答的问题

(复印件)

私有类解压缩扩展异步任务{
私有字符串_zipFile;
私有字符串_位置;
私人int per=0;
公共解压缩(字符串zipFile、字符串位置){
_zipFile=zipFile;
_位置=位置;
_dirChecker(“”);
}    
受保护整数doInBackground(){
试试{
ZipFile zip=新ZipFile(_ZipFile);
bar.setMax(zip.size());
FileInputStream fin=新的FileInputStream(_zipFile);
ZipInputStream zin=新的ZipInputStream(fin);
ZipEntry ze=null;
while((ze=zin.getnextery())!=null){
v(“解压缩”、“解压缩”+ze.getName());
如果(ze.isDirectory()){
_dirChecker(ze.getName());
}否则{
//这里我正在更新我的进度条
per++;
出版进度(per);
FileOutputStream fout=新的FileOutputStream(_location+ze.getName());
对于(int c=zin.read();c!=-1;c=zin.read()){
四、写(c);
}            
zin.closeEntry();
fout.close();
}                
}       
zin.close();
}捕获(例外e){
Log.e(“解压缩”、“解压”,e);
}    
}    
}
返回总大小;
}
受保护的void onProgressUpdate(整数…进度){
setProgress(per);//因为它是一个内部类,所以应该能够直接调用bar
}
受保护的void onPostExecute(整数…结果){
Log.i(“已完成。总尺寸:+结果”);
}
}
当我试图执行它时,它给出了一个错误:(152,9)错误

FileexplorerActivity.Decompress不是抽象的,并且不会覆盖AsyncTask中的抽象方法doInBackground(Void…)

如何解决此问题。

Asynctask中没有没有参数的doBackground()

protected abstract Result doInBackground (Params... params)

您应该在doBackground()中包含参数。

doInBackground()中包含参数。

protected abstract Result doInBackground (Params... params)
protected Integer doInBackground(Void... voids)
{
    ....
    return totalSize;
}