@Override protected void onStart() { // TODO Auto-generated method stub super.onStart(); BufferedWriter writer ; try { String path = getFilesDir().getAbsolutePath() ; File file = new File(path + "/etc") ; if(!file.exists()){ file.mkdirs() ; } File file2 = new File(file.getAbsoluteFile() + "/name.txt") ; FileOutputStream out = new FileOutputStream(file2); writer = new BufferedWriter(new OutputStreamWriter(out)) ; try { writer.write("123123") ; writer.close() ; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } }