android.os.Environment.getRootDirectory()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(446)

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

Environment.getRootDirectory介绍

暂无

代码示例

代码示例来源:origin: aa112901/remusic

  1. private BuildProperties() throws IOException {
  2. properties = new Properties();
  3. properties.load(new FileInputStream(new File(Environment.getRootDirectory(), "build.prop")));
  4. }

代码示例来源:origin: android-hacker/VirtualXposed

  1. private OSUtils() {
  2. Properties properties;
  3. try {
  4. properties = new Properties();
  5. properties.load(new FileInputStream(new File(Environment.getRootDirectory(), "build.prop")));
  6. } catch (IOException e) {
  7. properties = null;
  8. }
  9. if (properties != null) {
  10. emui = !TextUtils.isEmpty(properties.getProperty(KEY_EMUI_VERSION_CODE));
  11. miuiVersion = properties.getProperty(KEY_MIUI_VERSION_CODE);
  12. miui = !TextUtils.isEmpty(miuiVersion) || !TextUtils.isEmpty(properties.getProperty(KEY_MIUI_VERSION_NAME))
  13. || !TextUtils.isEmpty(properties.getProperty(KEY_MIUI_INTERNAL_STORAGE));
  14. }
  15. flyme = hasFlyme();
  16. }

代码示例来源:origin: jaydenxiao2016/AndroidFire

  1. public Builder(ImageLoader loader) {
  2. this.loader = loader;
  3. if (FileUtils.isSdCardAvailable())
  4. filePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Camera";
  5. else
  6. filePath = Environment.getRootDirectory().getAbsolutePath() + "/Camera";
  7. titleBgColor = Color.BLACK;
  8. titleColor = Color.WHITE;
  9. btnBgColor = Color.TRANSPARENT;
  10. btnTextColor = Color.WHITE;
  11. FileUtils.createDir(filePath);
  12. }

代码示例来源:origin: Bilibili/DanmakuFlameMaster

  1. public static synchronized ARCH getMyCpuArch() {
  2. byte[] data = new byte[20];
  3. File libc = new File(Environment.getRootDirectory(), "lib/libc.so");
  4. if (libc.canRead()) {
  5. RandomAccessFile fp = null;

代码示例来源:origin: joyoyao/superCleanMaster

  1. public static SDCardInfo getRootSpaceInfo() {
  2. File path = Environment.getRootDirectory();
  3. StatFs stat = new StatFs(path.getPath());
  4. long blockSize = stat.getBlockSize();
  5. long totalBlocks = stat.getBlockCount();
  6. long availableBlocks = stat.getAvailableBlocks();
  7. long totalSize = blockSize * totalBlocks;
  8. long availSize = availableBlocks * blockSize;
  9. // 获取SDCard上每个block的SIZE
  10. long nBlocSize = stat.getBlockSize();
  11. SDCardInfo info = new SDCardInfo();
  12. // 计算SDCard 总容量大小MB
  13. info.total = totalSize;
  14. // 计算 SDCard 剩余大小MB
  15. info.free = availSize;
  16. return info;
  17. }
  18. }

代码示例来源:origin: roomanl/AndroidDownload

  1. /**
  2. * 获取系统存储路径
  3. *
  4. * @return
  5. */
  6. public static String getRootDirectoryPath() {
  7. return Environment.getRootDirectory().getAbsolutePath();
  8. }

代码示例来源:origin: luhaoaimama1/zone-sdk

  1. /**
  2. * 获取系统存储路径
  3. *
  4. * @return
  5. */
  6. public static String getRootDirectoryPath() {
  7. return Environment.getRootDirectory().getAbsolutePath();
  8. }

代码示例来源:origin: 18Gray/CommonUtils

  1. /**
  2. * 获取系统存储路径
  3. */
  4. public static String getRootDirectoryPath()
  5. {
  6. return Environment.getRootDirectory().getAbsolutePath();
  7. }

代码示例来源:origin: Demidong/ClockView

  1. /**
  2. * 获取系统存储路径
  3. *
  4. * @return
  5. */
  6. public static String getRootDirectoryPath()
  7. {
  8. return Environment.getRootDirectory().getAbsolutePath();
  9. }

代码示例来源:origin: InnoFang/Android-Code-Demos

  1. /**
  2. * 获取系统存储路径
  3. *
  4. * @return
  5. */
  6. public static String getRootDirectoryPath() {
  7. return Environment.getRootDirectory().getAbsolutePath();
  8. }

代码示例来源:origin: HJXANDHMR/AndroidUtils

  1. /**
  2. * 获取系统存储路径
  3. *
  4. * @return
  5. */
  6. public static String getRootDirectoryPath() {
  7. return Environment.getRootDirectory().getAbsolutePath();
  8. }

代码示例来源:origin: jjdxmashl/jjdxm_baseutils

  1. /**
  2. * 获取系统存储路径
  3. *
  4. * @return
  5. */
  6. public static String getRootDirectoryPath() {
  7. return Environment.getRootDirectory().getAbsolutePath();
  8. }
  9. }

代码示例来源:origin: MoMoWait/LeanbackLauncher

  1. AppUsageStatistics(Context context) {
  2. this.mAppUsageScore = null;
  3. this.mLastGetAppUsageAdjustmentCall = 0;
  4. this.mContext = context;
  5. this.mUsageStatsManager = (UsageStatsManager) context.getSystemService("usagestats");
  6. try {
  7. mPrivilegedAppDir = new File(Environment.getRootDirectory(), "priv-app").getCanonicalPath();
  8. } catch (IOException e) {
  9. }
  10. }

代码示例来源:origin: rockon999/LeanbackLauncher

  1. AppUsageStatistics(Context context) {
  2. this.mContext = context;
  3. this.mUsageStatsManager = (UsageStatsManager) context.getSystemService("usagestats");
  4. try {
  5. mPrivilegedAppDir = new File(Environment.getRootDirectory(), "priv-app").getCanonicalPath();
  6. } catch (IOException e) {
  7. }
  8. }

代码示例来源:origin: linqssonny/Utils

  1. private static String getRootFolderAbsolutePath() {
  2. if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
  3. return Environment.getExternalStorageDirectory().getAbsolutePath();
  4. } else {
  5. return Environment.getRootDirectory().getAbsolutePath();
  6. }
  7. }
  8. }

代码示例来源:origin: ZhuoKeTeam/QPM

  1. private BuildProperties() throws IOException {
  2. properties = new Properties();
  3. properties.load(new FileInputStream(new File(Environment.getRootDirectory(), "build.prop")));
  4. }

代码示例来源:origin: jethroMu/FunProj

  1. private BuildProperties() throws IOException {
  2. properties = new Properties();
  3. properties.load(new FileInputStream(new File(Environment.getRootDirectory(), "build.prop")));
  4. }

代码示例来源:origin: linqssonny/Utils

  1. /***
  2. * return folder absolute path external storage
  3. *
  4. * @return
  5. */
  6. public static String getRootFolderAbsolutePath() {
  7. if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
  8. return Environment.getExternalStorageDirectory().getAbsolutePath();
  9. } else {
  10. return Environment.getRootDirectory().getAbsolutePath();
  11. }
  12. }
  13. }

代码示例来源:origin: dengshiwei/AndroidUtils

  1. /**
  2. * 获取系统存储路径
  3. * @return
  4. * SD卡存在返回正常路径;SD卡不存在返回""
  5. */
  6. public static String getSDCardRootPath(){
  7. if(isSDCardEnable()){
  8. return Environment.getRootDirectory().getAbsolutePath() + File.separator;
  9. }else{
  10. return "";
  11. }
  12. }

代码示例来源:origin: dengshiwei/AndroidUtils

  1. /**
  2. * 获取系统存储路径
  3. * @return
  4. * SD卡存在返回正常路径;SD卡不存在返回null
  5. */
  6. public static File getSDCardRootFile(){
  7. if(isSDCardEnable()){
  8. return Environment.getRootDirectory();
  9. }else{
  10. return null;
  11. }
  12. }

相关文章