public class MemoryManager extends Manager {private ActivityManager mActivityManager;public MemoryManager(Config config) {super(config);//获得ActivityManager服务的对象。mActivityManager = (ActivityManager) SDKUtil.getAppContext().getSystemService(Context.ACTIVITY_SERVICE);}public ActivityManager.MemoryInfo getMemoryInfo() {//获得MemoryInfo对象。ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();//获得系统可用内存,保存在MemoryInfo对象上。mActivityManager.getMemoryInfo(memoryInfo);return memoryInfo;}/*** 获取进程最大物理内存。* 系统为应用分配的内存,没有额外的扩充。** @return*/public int getMemoryClass() {return mActivityManager.getMemoryClass();}/*** 在Android 3.0之后,manifest支持largeheap选项,设置为true后可以为应用申请分配更多内存。* 开发者通过设置manifest文件中的<application>标签中largeHeap属性的值为"true",获得应用可使用的最大内存。** @return*/public int getLargeMemoryClass() {return mActivityManager.getLargeMemoryClass();}/*** Returns the size of the native heap.** @return The size of the native heap in bytes.*/public long getNativeHeapSize() {return android.os.Debug.getNativeHeapSize();}/*** Returns the amount of allocated memory in the native heap.** @return The allocated size in bytes.*/public long getNativeHeapAllocatedSize() {return android.os.Debug.getNativeHeapAllocatedSize();}/*** Returns the amount of free memory in the native heap.** @return The freed size in bytes.*/public long getNativeHeapFreeSize() {return android.os.Debug.getNativeHeapFreeSize();}/*** Returns the maximum amount of memory that the Java virtual machine will* attempt to use.  If there is no inherent limit then the value {@link* java.lang.Long#MAX_VALUE} will be returned.** @return the maximum amount of memory that the virtual machine will* attempt to use, measured in bytes*/public long maxMemory() {return Runtime.getRuntime().maxMemory();}
}

Android memery data sample相关推荐

  1. android 创建虚拟内存,在 Android 的 /data 目录下添加虚拟内存

    在 Android 的 /data 目录下添加虚拟内存 Android 系统上添加虚拟内存已经不是什么新鲜事了, 很多手机都支持, 通常都是将虚拟内存添加到 SD 卡上, 不过由于 SD 卡的的读写速 ...

  2. android绑定java,Java-android数据绑定-找不到类android.view.data

    我试图在我的android应用程序中实现数据绑定,但是我遇到了以下问题: java.lang.ClassNotFoundException:找不到类" android.view.data&q ...

  3. android Codec-specific data

    android Codec-specific data 在CCodec中,CCodecBufferChannel::onWorkDone回调的时候处理csd buffer void CCodecBuf ...

  4. android 访问data目录、6.0模拟器读写sdcard、相关sdcard路径

    转载请标明出处: http://blog.csdn.net/xx326664162/article/details/52259980 文章出自:薛瑄的博客 你也可以查看我的其他同类文章,也会让你有一定 ...

  5. android 手机分区失败怎么办,一种Android系统Data分区自修复方法及系统专利_专利查询 - 天眼查...

    1.一种Android系统Data分区自修复方法,其特征在于,包括: 步骤1: Android智能终端开机进入Android系统后,判断Data分区是否损坏,对Data分 区进行挂载,然后读取Data ...

  6. android meta data值获取的坑

    2019独角兽企业重金招聘Python工程师标准>>> 获取meta data的时候,正常的非纯数字的字符串,设置在value里面,用getString获取是正常的. 但是如果含有纯 ...

  7. cocos2d-x for android配置 运行 Sample on Linux OS

    1.从http://www.cocos2d-x.org/download下载稳定版 比如cocos2d-x-2.2 2.解压cocos2d-x-2.2.zip,比如本文将其解压到 /opt 目录下 3 ...

  8. 用较新版本的Android Studio Chipmunk编译旧版本的Android 21的Sample

    技术发展这么快,经常遇到需要使用新版本的Android Studio来开发运行旧的Android工程,此时需要处理gradle兼容的问题 问题一.Could not install Gradle di ...

  9. (两百八十八)Android R data stall检测机制学习

    1.简介 data stall检测机制就我现在的理解看来是Android 在网络校验成功后,对网络的一种持续监控措施,一旦发现当前网络断网,则通知ConnectivityService,进行相应的处理 ...

  10. android获得data data目录,Android 导出data/data目录数据库

    释放双眼,带上耳机,听听看~! 我们调试 App 的时候有时候要去除应用下 data/data/ 的文件,之前我都是运行在虚拟机上,然后再取出数据.今天发现一个好的方法,可以在真机上(不用 root ...

最新文章

  1. OpenBSD 6.0 将移除 Linux 子系统以改进安全
  2. C++中的引用(257BinaryTreePath)
  3. Django—模板渲染
  4. 1249. 移除无效的括号
  5. 第十九章 我国农村资金筹集
  6. 大学生们颤抖吧,中学生已经开始学Python了!
  7. python高级编程 豆瓣_《Python高级编程》读书笔记:方法解释顺序浅析
  8. 漏洞扫描与云服务器的安全防护
  9. android大智慧安装目录,大智慧文件目录
  10. LightningChart数据可视化工具图形控件教程47-SurfaceGridSeries3D(曲线网格系列3D)
  11. 前端开发_5.Electron和Nw.js学习总结
  12. 是你的栈啊-求你了告诉我逆波兰表达式
  13. TOP100summit:【分享实录】爆炸式增长的斗鱼架构平台的演进
  14. 达观数据荣获认知图谱产业建设“创新突破奖”,并与图谱知名专家共同探讨工业知识图谱应用落地
  15. 2009成渝微型计算机处于空白,学海园大联考 2020届高三信息卷(二)文综答案
  16. 设计技巧之:LOGO色彩搭配
  17. 多人赛跑用多线程实现
  18. 晨曦记账本,记账一目了然
  19. L1:一维圣维南方程
  20. (ESLint)Expected '===' and instead saw '=='

热门文章

  1. 观远数据完成2.8亿元C轮融资
  2. 阿诺医药C轮融资近1亿美元,快速推进肿瘤免疫创新药全球研发
  3. 【ARM开发】交叉编译Qt源码之(1)编译xcb
  4. 关于金蝶K3系统(工业)供应链部分,使用前需要基本了解的一些信息
  5. 第一个node.js应用
  6. ubuntu20.04 命令行下,复制与粘贴快捷键分别是ctrl+shift+c、 ctrl+shift+v
  7. windows 系统开启的端口调研
  8. 用计算机弹琴图纸,cad制作钢琴平面图的操作流程
  9. dbcp 出现的connection is closed的问题
  10. AI 之路、回顾 2021,展望 2022 :当代青年的小烦恼