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

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

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

Context.getExternalCacheDirs介绍

暂无

代码示例

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

@RequiresApi(KITKAT) @Override public File[] getExternalCacheDirs() {
  return mBase.getExternalCacheDirs();
}

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

@RequiresApi(KITKAT) @Override public File[] getExternalCacheDirs() {
  return mBase.getExternalCacheDirs();
}

代码示例来源:origin: goeasyway/EasyPlug

@Override
  public File[] getExternalCacheDirs() {
    return hostContext.getExternalCacheDirs();
  }
}

代码示例来源:origin: goeasyway/EasyPlug

@Override
public File[] getExternalCacheDirs() {
  return hostContext.getExternalCacheDirs();
}

代码示例来源:origin: kingargyle/adt-leanback-support

public static File[] getExternalCacheDirs(Context context) {
  return context.getExternalCacheDirs();
}

代码示例来源:origin: stackoverflow.com

PackageManager pm = getPackageManager();
List<ApplicationInfo> installedApplications = pm.getInstalledApplications(0);
for (ApplicationInfo applicationInfo : installedApplications) {
 try {
  Context packageContext = createPackageContext(applicationInfo.packageName, 0);
  List<File> directories = new ArrayList<>();
  directories.add(packageContext.getCacheDir());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
   Collections.addAll(directories, packageContext.getExternalCacheDirs());
  } else {
   directories.add(packageContext.getExternalCacheDir());
  }

  StringBuilder command = new StringBuilder("rm -rf");
  for (File directory : directories) {
   command.append(" \"" + directory.getAbsolutePath() + "\"");
  }

  Shell.SU.run(command.toString());
 } catch (PackageManager.NameNotFoundException wtf) {
 }
}

相关文章

Context类方法