어플을 사용하다보면 어플이 종료될때 어플을 실행하면서 쌓이는 캐시나 데이터를 제거가 필요할때가 있습니다. 왠만하면 필요하지 않지만 캐시와 데이터 제거가 필요한 그때를 위해서 포스팅합니다. File cache = getApplicationContext().getCacheDir(); File appDir = new File(cache.getParent()); if (appDir.exists()) { String[] children = appDir.list(); for (String s : children) { deleteDir(new File(appDir, s)); } }
Android/코딩
2015. 10. 30. 15:01