android.content.Context.deleteFile()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(262)

本文整理了Java中android.content.Context.deleteFile()方法的一些代码示例,展示了Context.deleteFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.deleteFile()方法的具体详情如下:
包路径:android.content.Context
类名称:Context
方法名:deleteFile

Context.deleteFile介绍

暂无

代码示例

代码示例来源:origin: AltBeacon/android-beacon-library

/**
 * Client applications should not call directly.  Call BeaconManager#setRegionStatePeristenceEnabled
 */
public synchronized void stopStatusPreservation() {
  mContext.deleteFile(STATUS_PRESERVATION_FILE_NAME);
  this.mStatePreservationIsOn = false;
}

代码示例来源:origin: oasisfeng/condom

@Override public boolean deleteFile(String name) {
  return mBase.deleteFile(name);
}

代码示例来源:origin: AltBeacon/android-beacon-library

public synchronized void clear() {
  mContext.deleteFile(STATUS_PRESERVATION_FILE_NAME);
  getRegionsStateMap().clear();
}

代码示例来源:origin: facebook/facebook-android-sdk

} finally {
  Utility.closeQuietly(ois);
  context.deleteFile(PERSISTED_SESSION_INFO_FILENAME);
  if (appSessionInfoMap == null) {
    appSessionInfoMap =

代码示例来源:origin: robolectric/robolectric

@Test
public void deleteFile_shouldReturnFalse() throws IOException {
 File filesDir = context.getFilesDir();
 File file = new File(filesDir, "test.txt");
 boolean successfully = context.deleteFile(file.getName());
 assertThat(successfully).isFalse();
}

代码示例来源:origin: robolectric/robolectric

@Test
public void deleteFile_shouldReturnTrue() throws IOException {
 File filesDir = context.getFilesDir();
 File file = new File(filesDir, "test.txt");
 boolean successfully = file.createNewFile();
 assertThat(successfully).isTrue();
 successfully = context.deleteFile(file.getName());
 assertThat(successfully).isTrue();
}

代码示例来源:origin: AltBeacon/android-beacon-library

if (getRegionsStateMap().size() > MAX_REGIONS_FOR_STATUS_PRESERVATION) {
  LogManager.w(TAG, "Too many regions being monitored.  Will not persist region state");
  mContext.deleteFile(STATUS_PRESERVATION_FILE_NAME);

代码示例来源:origin: Trumeet/MiPushFramework

@Override public boolean deleteFile(String name) {
  return mBase.deleteFile(name);
}

代码示例来源:origin: westnordost/StreetComplete

private void deleteCrashReport()
{
  appCtx.deleteFile(CRASHREPORT);
}

代码示例来源:origin: westnordost/StreetComplete

context.deleteFile(QUEST_ICONS_FILE);
FileOutputStream spriteSheetIconsFile = context.openFileOutput(QUEST_ICONS_FILE, Context.MODE_PRIVATE);
spriteSheet.compress(Bitmap.CompressFormat.PNG, 0, spriteSheetIconsFile);

代码示例来源:origin: ukanth/afwall

context.deleteFile(BOGUS_FILE_NAME);

代码示例来源:origin: Stericson/RootTools

context.deleteFile(BOGUS_FILE_NAME);

代码示例来源:origin: 2tu/fit

/**
  * Delete the given private file associated with this Context's application package.
  *
  * @param context {@link Context}
  * @param name The name of the file to delete; can not contain path separators.
  * @return true if the file was successfully deleted; else false.
  * @since 1.0.1
  */
 public static boolean deleteFile(Context context, String name) {
  return context.deleteFile(name);
 }
}

代码示例来源:origin: GuoFeilong/LifeHelper

/**
 * 删除工程目录下指定文件
 */
public static boolean deleteWithProject(Context context, String fileName) {
  if (null != context) {
    return context.deleteFile(fileName);
  }
  return false;
}

代码示例来源:origin: adjust/android_sdk

public static boolean deleteSessionPartnerParameters(Context context) {
  return context.deleteFile(SESSION_PARTNER_PARAMETERS_FILENAME);
}

代码示例来源:origin: reloZid/android-anuto

@Override
public void error(Exception e, int loopCount) {
  // avoid game not starting anymore because of a somehow corrupt saved game file
  if (loopCount < 10) {
    Log.w(TAG, "Game crashed just after loading, deleting saved game file.");
    mContext.deleteFile(SAVED_GAME_FILE);
  }
}

代码示例来源:origin: org.openmobster.core.mobileCloud.android.2_0/common

public void cleanup(String file)
  {
    Context context = Registry.getActiveInstance().getContext();
    
    file = file.substring("file:///".length());
    
    context.deleteFile(file);
  }
}

代码示例来源:origin: yuger/VPN_2017

public void removeProfile(Context context, VpnProfile profile) {
    String vpnentry = profile.getUUID().toString();
    profiles.remove(vpnentry);
    saveProfileList(context);
    context.deleteFile(vpnentry + ".vp");
    if (mLastConnectedVpn == profile) mLastConnectedVpn = null;
  }
}

代码示例来源:origin: quaap/LaunchTime

public static void deleteBitmap(Context context, ComponentName cname, IconType iconType) {
  String fname  = makeSafeName(cname, iconType);
  if (fileExists(context, fname)) {
    context.deleteFile(fname);
  }
}

代码示例来源:origin: Doctoror/PainlessMusicPlayer

@Test
public void testReadFromFileWhenNull() {
  final String fileName = "protoUtilsReadFromFileWhenNull";
  final Context context = RuntimeEnvironment.application;
  context.deleteFile(fileName);
  final SettingsProto.Settings read = ProtoUtils.readFromFile(
      context, fileName, new SettingsProto.Settings());
  assertNull(read);
}

相关文章

Context类方法