如何解决android asynctask加载文件错误?

如何解决android asynctask加载文件错误?,android,android-asynctask,bmp,Android,Android Asynctask,Bmp,函数中bmp的异步任务加载文件返回 这只是安卓操作系统3.12的唯一错误 如何优化异步任务 File tileFile = null; tileFile = layerTmp.urlMaker_.makeCacheFile(DEFAULT_TILE_CACHE_PATH, tileTmp.tileCoords, (mapView_.getZoomLevel() - mapView_.getAdjustLevelPoint()), layer.la

函数中bmp的异步任务加载文件返回 这只是安卓操作系统3.12的唯一错误 如何优化异步任务

            File tileFile = null;

            tileFile = layerTmp.urlMaker_.makeCacheFile(DEFAULT_TILE_CACHE_PATH, tileTmp.tileCoords, (mapView_.getZoomLevel() - mapView_.getAdjustLevelPoint()), layer.layerName_);

            if(tileFile != null) {
                fis = new FileInputStream(tileFile);
            } else {
                throw new Exception("load error");
            }

            out = new ByteArrayOutputStream();
            bis = new BufferedInputStream(fis);

            if (isCancelled()) throw new Exception("task cancel");

            boolean isComplete = false;
            isComplete = interruptableStreamCopy(bis, out);

            if (!isComplete) throw new Exception("task cancel");
            out.flush();

            final byte[] data = out.toByteArray();
            out.close();

            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inPreferredConfig = Bitmap.Config.RGB_565;              
            options.inDither = false; //Disable Dithering mode
            options.inPurgeable=true;                   //Tell to gc that whether it needs free memory, the Bitmap can be cleared
            options.inInputShareable=true;              //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future
            options.inTempStorage=new byte[32 * 1024]; 

            bmp = BitmapFactory.decodeByteArray(data, 0, data.length, options);

            if (bmp  == null) {
                if(tileFile != null)
                    tileFile.delete();

                try {
                    throw new IOException("Image file was not decodable: "+ tileFile);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            if (isCancelled()) throw new Exception("task cancel");

            if (mapView_.getAdjustLevelPoint() > 0) {
                bmp = Bitmap.createScaledBitmap(bmp , bmp.getWidth() << mapView_.getAdjustLevelPoint(), bmp.getHeight() << mapView_.getAdjustLevelPoint(), true);
            }
文件tileFile=null;
tileFile=layerTmp.urlMaker.makeCacheFile(默认的TILE\u CACHE\u路径,tileTmp.tileCoords,(mapView.getZoomLevel()-mapView.getAdjustLevelPoint()),layer.layerName);
if(tileFile!=null){
fis=新文件输入流(tileFile);
}否则{
抛出新异常(“加载错误”);
}
out=新的ByteArrayOutputStream();
bis=新的缓冲数据流(fis);
如果(isCancelled())抛出新异常(“任务取消”);
布尔值isComplete=false;
isComplete=可中断流复制(bis,out);
如果(!isComplete)抛出新异常(“任务取消”);
out.flush();
最后一个字节[]数据=out.toByteArray();
out.close();
BitmapFactory.Options=new-BitmapFactory.Options();
options.inPreferredConfig=Bitmap.Config.RGB_565;
options.inDither=false//禁用抖动模式
options.inpurgable=true//告诉gc是否需要空闲内存,位图可以被清除
选项。inInputShareable=true//清除位图数据后,将使用哪种引用来恢复位图数据,将来何时使用
options.inTempStorage=新字节[32*1024];
bmp=BitmapFactory.decodeByteArray(数据,0,数据长度,选项);
如果(bmp==null){
if(tileFile!=null)
delete();
试一试{
抛出新IOException(“图像文件不可解码:“+tileFile”);
}捕获(IOE异常){
e、 printStackTrace();
}
}
如果(isCancelled())抛出新异常(“任务取消”);
如果(mapView_u2;.getAdjustLevelPoint()>0){
bmp=Bitmap.createScaledBitmap(bmp,bmp.getWidth()>

kr.co.lgupgis.map能否将日志的大小减小到您怀疑的问题所在?如何调用此任务?