File file = Environment.getExternalStorageDirectory();
File file_0 = new File(file, "file_demo");
if (!file_0.exists()) {
file_0.mkdirs();
}
File file = Environment.getExternalStorageDirectory();
File file_0 = new File(file, "pic");
if (!file_0.exists()) {
file_0.mkdirs();
}
try {
File pic = new File(file_0, "pic.png");
InputStream is = getResources().openRawResource(
R.drawable.ic_launcher);
OutputStream os = new FileOutputStream(pic);
byte[] data = new byte[is.available()];
is.read(data);
os.write(data);
is.close();
os.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}