Environment中涉及到外部存储路径…

Environment中涉及到外部存储路径和储存大小API(测试机:魅族MX2,用其他测试机测试结果会有不同):
System.out.println("getExternalStorageDirect ory.getAbsolutePath===="+Environment.getExternalStorageDirect ory().getAbsolutePath());// /mnt/sdcard
System.out.println("getExternalStorageDirect ory.getPath===="+Environment.getExternalStorageDirect ory().getPath());//   /mnt/sdcard
System.out.println("getExternalStorageDirect ory.getName===="+Environment.getExternalStorageDirect ory().getName());//   sdcard
System.out.println("getExternalStorageDirect ory.getParent===="+Environment.getExternalStorageDirect ory().getParent());// /mnt
System.out.println("getExternalStorageDirect ory.getFreeSpace===="+Environment.getExternalStorageDirect ory().getFreeSpace()); // 12124454912
System.out.println("getExternalStorageDirect ory.getTotalSpace===="+Environment.getExternalStorageDirect ory().getTotalSpace());// 12624855040
System.out.println("getExternalStorageDirect ory.getUsableSpace===="+Environment.getExternalStorageDirect ory().getUsableSpace());// 12124454912
System.out.println("getExternalStorageState===="+Environment.getExternalStorageState());// mounted
System.out.println("getDataDirectory.getAbsolutePath===="+Environment.getDataDirectory().getAbsolutePath());//   /data
System.out.println("getDataDirectory.getPath===="+Environment.getDataDirectory().getPath()); //   /data
System.out.println("getDataDirectory.getName===="+Environment.getDataDirectory().getName());//   data
System.out.println("getDataDirectory.getParent===="+Environment.getDataDirectory().getParent());//   /
System.out.println("getDataDirectory.getFreeSpace===="+Environment.getDataDirectory().getFreeSpace());// 1912451072
System.out.println("getDataDirectory.getTotalSpace===="+Environment.getDataDirectory().getTotalSpace());// 2113748992
System.out.println("getDataDirectory.getUsableSpace===="+Environment.getDataDirectory().getUsableSpace());// 1912451072
System.out.println("getDownloadCacheDirector y.getAbsolutePath===="+Environment.getDownloadCacheDirector y().getAbsolutePath());// /cache
System.out.println("getDownloadCacheDirector y.getPath===="+Environment.getDownloadCacheDirector y().getPath());// /cache
System.out.println("getDownloadCacheDirector y.getName===="+Environment.getDownloadCacheDirector y().getName());//   cache
System.out.println("getDownloadCacheDirector y.getParent===="+Environment.getDownloadCacheDirector y().getParent());// /
System.out.println("getDownloadCacheDirector y.getFreeSpace===="+Environment.getDownloadCacheDirector y().getFreeSpace());// 201908224
System.out.println("getDownloadCacheDirector y.getTotalSpace===="+Environment.getDownloadCacheDirector y().getTotalSpace());// 206405632
System.out.println("getDownloadCacheDirector y.getUsableSpace===="+Environment.getDownloadCacheDirector y().getUsableSpace());// 201908224

注意:涉及到大小的API sdk必须到大于9!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值