Programming/Android Android file save 생각하는로뎅 2013. 4. 3. 11:39 반응형 /** * file save * * @param title * @param data */ public boolean fileSave(String title, String data) { // android sdcard root directory path String path = Environment.getExternalStorageDirectory() .getAbsolutePath() + "/디렉토리 명"; File file = new File(path); // if not file directory, create directory if (!file.exists()) { file.mkdir(); } FileOutputStream fos = null; try { file = new File(path + "/" + title + ".txt"); // file create fos = new FileOutputStream(file, true); // file write fos.write((data).getBytes()); // file close fos.close(); return true; } catch (IOException e) { e.printStackTrace(); return false; } } 반응형