Example usage for android.content Context deleteFile

List of usage examples for android.content Context deleteFile

Introduction

In this page you can find the example usage for android.content Context deleteFile.

Prototype

public abstract boolean deleteFile(String name);

Source Link

Document

Delete the given private file associated with this Context's application package.

Usage

From source file:Main.java

public static void deleteFile(Context paramContext) {
    paramContext.deleteFile("activitypath.txt");
}

From source file:Main.java

public static void deleteFile(Context context, String filename) {
    context.deleteFile(filename);
}

From source file:Main.java

public static void deleteExperimentCachesOnDisk(Context context2) {
    context2.deleteFile(MY_EXPERIMENTS_FILENAME);
    context2.deleteFile(PUBLIC_EXPERIMENTS_FILENAME);
}

From source file:Main.java

public static boolean deleteFile(Context context, String fileName) {
    return context.deleteFile(fileName);
}

From source file:Main.java

/**
 * @param pContext/* ww  w  . j  a va 2s.c om*/
 * @param pFileName
 * @return
 */
public static boolean deleteAppPrivateFile(Context pContext, String pFileName) {
    try {
        return pContext.deleteFile(pFileName);
    } catch (Exception e) {
        Log.e(LOG_TAG, "deleteAppPrivateFile: " + pFileName);
        return false;
    }
}

From source file:com.apps.android.viish.encyclolpedia.tools.ImageManager.java

public static void deleteImage(Context context, String fileName) {
    context.deleteFile(fileName);
}

From source file:Main.java

/**
 * Delete the wishlist/*from  w w  w .ja  v  a  2s  .co  m*/
 *
 * @param mCtx A context to open the file wish
 */
public static void ResetCards(Context mCtx) {

    String[] files = mCtx.fileList();
    for (String fileName : files) {
        if (fileName.equals(WISHLIST_NAME)) {
            mCtx.deleteFile(fileName);
        }
    }
}

From source file:Main.java

/**
 * Deletes the given file from internal storage. If the file doesn't exist this will return
 * an error./* w ww  .  ja  v  a 2s . c om*/
 *
 * @author Ian Copland
 *
 * @param in_context - The active context.
 * @param in_filePath - The file path
 *
 * @return Whether or not this was successful.
 */
public static boolean removeFile(Context in_context, String in_filePath) {
    if (doesFileExist(in_context, in_filePath) == false) {
        return false;
    }

    return in_context.deleteFile(in_filePath);
}

From source file:com.adjust.sdk.PackageHandler.java

public static Boolean deletePackageQueue(Context context) {
    return context.deleteFile(PACKAGE_QUEUE_FILENAME);
}

From source file:Main.java

/**
 * Rename existing file in same directory if target file exists, delete
 * Code nicked from http://stackoverflow.com/users/325442/mr-bungle
 * @param context/*from   w  ww . j  av  a2 s  .co m*/
 * @param originalFileName
 * @param newFileName
 */
private static void rename(Context context, String originalFileName, String newFileName) {
    File originalFile = context.getFileStreamPath(originalFileName);
    if (originalFile.exists()) {
        Log.d("SavingHelper",
                "renaming " + originalFileName + " size " + originalFile.length() + " to " + newFileName);
        File newFile = new File(originalFile.getParent(), newFileName);
        if (newFile.exists()) {
            context.deleteFile(newFileName);
        }
        originalFile.renameTo(newFile);
    }
}