i am saving video and image in a folder ..now i want to make this folder as password protected , means while opening this folder needs to enter a password for view the file inside it
hope here ill get any relevant answer for doing this…if there some any other possible please suggest..
try {
dirName = "/mydirectory/";
fileName = new Long(
SystemClock.currentThreadTimeMillis())
.toString()
+ ".png";
} catch (NullPointerException e) {
// TODO: handle exception
}
try {
if (android.os.Environment
.getExternalStorageState()
.equals(android.os.Environment.MEDIA_MOUNTED)) {
File sdCard = Environment
.getExternalStorageDirectory();
File dir = new File(sdCard.getAbsolutePath()
+ dirName);
dir.mkdirs();
File file = new File(storedImagePath);
os = new FileOutputStream(file, true);
byte[] byteArray = receivedImageData.getBytes();
byteArray = Base64.decode(byteArray, 0);
os.write(byteArray);
os.flush();
os.close();
} else {
}
} catch (Exception e) {
}
I’d like to suggest a different/feasible approach, Encrypt your file!
Look at this answer!
Even if you are successful in implementing a password protection (Wow!) here are the cons,