private void downloadFile(String adress, String localFileName) {
                OutputStream out = null;
                URLConnection conn;
                InputStream in = null;
                
                try {
                    URL url = new URL(adress);
                    out = new BufferedOutputStream(
                    new FileOutputStream(getCacheDir() + "/" +localFileName)); 

                    conn = url.openConnection();
                    in = conn.getInputStream(); 
                
                    byte[] data = new byte[BUFFER]; 
        
                    int numRead;
                    long numWritten = 0;
                    int length = conn.getContentLength();

        
                        while((numRead = in.read(data)) != -1) {
                                out.write(data, 0, numRead);
                                numWritten += numRead;
                                int percentage = (int)(((double)numWritten / (double)length) * 100D);
                                drawLoadingText(percentage, "Be patient... cache is downloading.");
                        }
                        drawLoadingText(100, "Download finished, unzipping files...");

                } catch (Exception exception) {
                        exception.printStackTrace();
                } finally {
                        try {
                                if (in != null) {
                                        in.close();
                                }
                                if (out != null) {
                                        out.close();
                                }
                        } catch (IOException ioe) {
                        }
                }

        }