I know that this is FAQ, but I have another question. Let's say that I have some id, and using this id, i got some json file, where I have encrypted string, after this I decrypted this string, and this String is Base64String, and now I want to create some file and write this decrypted string into file, and open this file like pdf. And about ecrypted string, it's also Base64String, this was created like read pdf file, get all data from pdf file. And my question it's how to create file into android storage automatically and open into pdf format, Beforehand without creating file into android phone memory?
Asked
Active
Viewed 80 times
1 Answers
0
//check if external storage is writable
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), fileName);
if (!file.mkdirs()) {
Log.e(LOG_TAG, "Directory not created");
}else{
//to wirte in storage
FileOutputStream os = outStream = new FileOutputStream(file);
String data = //put your data
os.write(data.getBytes());
os.close();
}
}

Meikiem
- 1,876
- 2
- 11
- 19