Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import java.io.File; public class Main { public static void cleanFiles(Context context) { deleteFilesByDirectory(context.getFilesDir()); } private static void deleteFilesByDirectory(File directory) { if (directory != null && directory.exists() && directory.isDirectory()) { for (File item : directory.listFiles()) { if (item.isDirectory()) { deleteFilesByDirectory(item); } item.delete(); } directory.delete(); } } }