Example usage for android.app Activity fileList

List of usage examples for android.app Activity fileList

Introduction

In this page you can find the example usage for android.app Activity fileList.

Prototype

@Override
    public String[] fileList() 

Source Link

Usage

From source file:org.matrix.matrixandroidsdk.db.ConsoleMediasCache.java

/**
 * Clear the medias caches./*from   w ww  . ja  v  a  2s.c  o  m*/
 * @param context The application context to use.
 */
public static void clearCache(Activity context) {
    String[] filesList = context.fileList();

    for (String file : filesList) {
        try {
            context.deleteFile(file);
        } catch (Exception e) {

        }
    }

    BitmapWorkerTask.clearBitmapsCache();
}

From source file:org.matrix.matrixandroidsdk.db.ConsoleMediasCache.java

/**
 * Compute the filesystem cache size/*from www  .ja  v  a 2s . c  o  m*/
 * @param context
 * @return the medias cache size in bytes
 */
public static long cacheSize(Activity context) {
    long size = 0;
    String[] filesList = context.fileList();

    for (String filename : filesList) {
        try {
            File file = new File(context.getFilesDir(), filename);
            size += file.length();
        } catch (Exception e) {

        }
    }
    return size;
}