List of usage examples for android.content Context deleteFile
public abstract boolean deleteFile(String name);
From source file:com.mediatek.mms.util.VCardUtils.java
public static void deleteVCardTempFile(Context context, String filename) { if (filename != null && filename.endsWith(".vcf")) { context.deleteFile(filename); }/* w ww.java2s . c o m*/ }
From source file:it.mb.whatshare.PairOutboundActivity.java
/** * Saves the argument <tt>device</tt> as the (only) configured outbound * device./* w ww. j a v a2 s . com*/ * * <p> * If <tt>device</tt> is <code>null</code>, the currently configured device * is deleted. * * @param device * the device to be stored, or <code>null</code> if the current * association must be discarded * @param context * the application's context (used to open the association file * with) * @throws IOException * in case something is wrong with the file * @throws JSONException * in case something is wrong with the argument <tt>device</tt> */ public static void savePairing(PairedDevice device, Context context) throws IOException, JSONException { if (device == null) { Utils.debug("deleting outbound device... %s", context.deleteFile(PAIRING_FILE_NAME) ? "success" : "fail"); } else { FileOutputStream fos = context.openFileOutput(PAIRING_FILE_NAME, Context.MODE_PRIVATE); // @formatter:off JSONObject json = new JSONObject().put("name", device.name).put("type", device.type).put("assignedID", device.id); // @formatter:on PrintStream writer = new PrintStream(fos); writer.append(json.toString()); writer.flush(); writer.close(); } }
From source file:com.adjust.sdk.ActivityHandler.java
public static boolean deleteActivityState(Context context) { return context.deleteFile(ACTIVITY_STATE_FILENAME); }
From source file:com.adjust.sdk.ActivityHandler.java
public static boolean deleteAttribution(Context context) { return context.deleteFile(ATTRIBUTION_FILENAME); }
From source file:com.lee.sdk.utils.Utils.java
/** * ???data/data/package-name/files/*from w w w . j a v a2 s .co m*/ * * @param context context * @param name ????? * @return true?false */ public static boolean deleteCache(Context context, String name) { boolean succeed = false; try { succeed = context.deleteFile(name); } catch (Exception e) { e.printStackTrace(); } return succeed; }
From source file:org.wahtod.wififixer.utility.LogUtil.java
private static String getStackTrace(Context context) { StringBuilder trace = new StringBuilder(); DataInputStream d;/* w ww . j a v a2 s. c om*/ try { d = new DataInputStream(context.openFileInput(DefaultExceptionHandler.EXCEPTIONS_FILENAME)); } catch (FileNotFoundException e1) { return trace.append(context.getString(R.string.no_stack_trace_found)).toString(); } for (;;) { try { trace.append(d.readUTF()); } catch (EOFException e) { trace.append(e); } catch (IOException e) { trace.append(e); } finally { try { d.close(); } catch (IOException e) { trace.append(e); } } context.deleteFile(DefaultExceptionHandler.EXCEPTIONS_FILENAME); return trace.toString(); } }
From source file:com.project.qrypto.keymanagement.KeyManager.java
/** * Deletes the keystore from internal or external memory depending on settings * @param context the context to use//from w w w . j a v a 2 s. com */ public void delete(Context context) { //Perform the delete. if (internalStorage) { context.deleteFile(KEYSTORE); } //Clear out shared preferences because they are not longer valid SharedPreferences preferences = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE); preferences.edit().clear().commit(); }
From source file:net.tawacentral.roger.secrets.FileUtils.java
/** Deletes all secrets from the phone. * @param context the current context/*from ww w. j a v a 2 s . com*/ * @return always true */ public static boolean deleteSecrets(Context context) { Log.d(LOG_TAG, "FileUtils.deleteSecrets"); synchronized (lock) { String filenames[] = context.fileList(); for (String filename : filenames) { context.deleteFile(filename); } } return true; }
From source file:com.rcythr.masq.keymanagement.KeyManager.java
/** * Deletes the keystore from internal or external memory depending on settings * @param context the context to use// w w w .jav a 2 s.co m */ public void delete(Context context) { //Perform the delete. if (internalStorage) { context.deleteFile(KEYSTORE); } else { getSDCardFile().delete(); } //Clear out shared preferences because they are not longer valid SharedPreferences preferences = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE); preferences.edit().clear().commit(); }
From source file:com.rcythr.masq.keymanagement.KeyManager.java
/** * Move Keystore from internal to external memory or vice versa depending on settings * @param context the context to use/* ww w .j av a2 s . c om*/ * @return true if successful, false otherwise */ public boolean swap(Context context) { boolean initialState = internalStorage; try { //Toggle it internalStorage ^= true; //Create it all new commit(context); //Delete the old location if (!internalStorage) { context.deleteFile(KEYSTORE); } else { getSDCardFile().delete(); } } catch (Exception e) { e.printStackTrace(); internalStorage = initialState; return false; } return true; }