반응형
private void dataSaveLog(String _log, String _fileName)
{
/* SD CARD 하위에 LOG 폴더를 생성하기 위해 미리 dirPath에 생성 할 폴더명을 추가 */
String dirPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/LOG/";
File file = new File(dirPath);
// 일치하는 폴더가 없으면 생성
if (!file.exists())
file.mkdirs();
// txt 파일 생성
File savefile = new File(dirPath + "LOG_" + _fileName + ".txt");
try {
BufferedWriter bfw = new BufferedWriter(new FileWriter(dirPath + "LOG_" + _fileName + ".txt", true));
bfw.write(_log);
bfw.write("\n");
bfw.flush();
bfw.close();
} catch (IOException e)
{
/* Exception */
}
}
반응형
'MOBILE' 카테고리의 다른 글
C서버와 소켓통신 (0) | 2016.08.21 |
---|---|
CheckBox(체크박스) 이미지 변경하기 (0) | 2016.08.21 |
Custom ListView (커스텀 리스트뷰) Footer를 이용한 더보기 구현 (0) | 2016.08.21 |
뒤로가기(Back 버튼) 두번 눌러 앱 종료하기 (0) | 2016.08.21 |
현재시간(Local Time) 가져오기 (0) | 2016.08.21 |
안드로이드 앱 최초 실행시 바탕화면에 아이콘(Shortcut) 생성하기 (0) | 2016.08.21 |
안드로이드 PHP GET 방식 통신에서 한글 깨짐(?) 해결 (0) | 2016.08.21 |
Android SharedPreferences 사용 예제 (0) | 2016.08.21 |
댓글