/** Return true if download should continue, otherwise false; */ private boolean errorCheckPathAndFile(String filename) { if (TextUtils.isEmpty(filename)) { Toast.makeText( VizApp.getContext(), VizApp.getResString(R.string.invalid_filename), Toast.LENGTH_LONG) .show(); return false; } File downloadDir = VizUtils.getDownloadDir(); if (downloadDir == null || !downloadDir.exists()) { Toast.makeText( VizApp.getContext(), VizApp.getResString(R.string.directory_access_error), Toast.LENGTH_LONG) .show(); return false; } if (!downloadDir.canWrite() || !downloadDir.canRead()) { Toast.makeText( VizApp.getContext(), VizApp.getResString(R.string.directory_access_error), Toast.LENGTH_LONG) .show(); return false; } File file = VizUtils.getVideoFile(filename); if (file != null && file.exists()) { Toast.makeText( VizApp.getContext(), VizApp.getResString(R.string.file_exists_error), Toast.LENGTH_LONG) .show(); return false; } return true; }