You better use this :
File dir = Environment.getExternalStorageDirectory();
String filename = "test.pdf";
File f = new File(dir, filename);
f.createNewFile();
OutputStream outStream = new FileOutputStream(f);
...
outStream.close();
--
You received this message because you are subscribed
Yes, Thank you JP... I got the solution...
//Creating new File in sdcard
byte[] bytes;
File createfile = new File("/sdcard/Androidrox/");
createfile.mkdirs();
File outputFile = new File(createfile, "Sample.pdf");
FileOutputStream fos = new FileOutputStream(outputFile);
//Writing into the PDF Fil
Michael points in the right direction. You need write permission to /
sdcard, which is known as external storage.
Here's the documentation:
http://developer.android.com/guide/topics/data/data-storage.html#filesExternal
You also need to add the WRITE_EXTERNAL_STORAGE permission to the app
manifest.
3 matches
Mail list logo