try {
            Resources res = context.getResources();
            FileOutputStream outStream = new FileOutputStream(file);
            InputStream inputStream = res.openRawResource(resId);
            copyFile(inputStream, outStream);