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

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

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

Context.fileList介绍

暂无

代码示例

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

@Override public String[] fileList() {
  return mBase.fileList();
}

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

@Test
public void fileList() throws Exception {
 assertThat(context.fileList()).isEqualTo(context.getFilesDir().list());
}

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

@Override public String[] fileList() {
  return mBase.fileList();
}

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

private boolean hasCrashReport()
{
  return Arrays.asList(appCtx.fileList()).contains(CRASHREPORT);
}

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

public static List<File> getAllIcons(Context context) {
  List<File> files = new ArrayList<>();
  for (String fn: context.fileList()) {
    if (fn.endsWith(".png")) {
      Log.d("SpecialIconStore", " I see file " + fn);
      files.add(new File(context.getFilesDir(), fn));
    }
  }
  return files;
}

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

public List<String> listBackups() {
  List<String> list = new ArrayList<>();
  Pattern bakpat = Pattern.compile("^" + Pattern.quote(BK_PRE)  + "(.+)");
  for (String file: mContext.fileList()) {
    Matcher m = bakpat.matcher(file);
    if (m.matches()) {
      list.add(m.group(1));
    }
  }
  Collections.sort(list);
  Collections.reverse(list);
  return list;
}

代码示例来源:origin: AEFeinstein/mtg-familiar

/**
 * Delete the wishlist
 *
 * @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);
    }
  }
}

代码示例来源:origin: rogerta/secrets-for-android

/** Deletes all secrets from the phone.
 * @param context the current context
 * @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;
}

代码示例来源:origin: rogerta/secrets-for-android

String[] filenames = context.fileList();

代码示例来源:origin: rogerta/secrets-for-android

/**
 * Get all existing restore points, including the restore file on the SD card
 * if it exists.
 *
 * @param context Activity context in which the save is called.
 * @return A list of all possible restore points.
 */
public static List<String> getRestorePoints(Context context) {
 String[] filenames = context.fileList();
 ArrayList<String> list = new ArrayList<String>(filenames.length + 2);
 if (restoreFileExist())
  list.add(SECRETS_FILE_NAME_SDCARD);
 // To ease restoring from Google Drive, look for a secrets file in the
 // downloads folder and add that option.
 File downloads = Environment.getExternalStoragePublicDirectory(
   Environment.DIRECTORY_DOWNLOADS);
 File rpDownload = new File(downloads, SECRETS_FILE_NAME);
 if (rpDownload.exists())
  list.add(rpDownload.getAbsolutePath());
 for (String filename : filenames) {
  if (filename.startsWith(RP_PREFIX))
   list.add(filename);
 }
 return list;
}

代码示例来源:origin: WireGuard/wireguard-android

@Override
public Set<String> enumerate() {
  return Stream.of(context.fileList())
      .filter(name -> name.endsWith(".conf"))
      .map(name -> name.substring(0, name.length() - ".conf".length()))
      .collect(Collectors.toUnmodifiableSet());
}

代码示例来源:origin: rogerta/secrets-for-android

Log.d(LOG_TAG, "FileUtils.cleanupDataFiles");
synchronized (lock) {
 String[] filenames = context.fileList();
 int oldCount = filenames.length;
 boolean secretsFileExists = context.getFileStreamPath(SECRETS_FILE_NAME)

相关文章

Context类方法