精华帖 (0) :: 良好帖 (2) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2011-07-20
最后修改:2011-07-21
剩下的几个未完成的给几个提示,其实就是文件读写操作,handler,还有TimeTask结合去处理,然后绘图,更新ui /sys/class/net /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq /proc/stat /proc/self/net/dev /proc/meminfo 这几个文件一看名字你们就懂,不过这几个文件在ddms中你看不到哟,不能导出来.
再贴几个方法 public long getAvailMemory() { ActivityManager am = (ActivityManager)mContext.getSystemService(Context.ACTIVITY_SERVICE); ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); am.getMemoryInfo(mi); return mi.availMem; } public long[] getRomMemroy() { long[] romInfo = new long[2]; //Total rom memory romInfo[0] = getTotalInternalMemorySize(); //Available rom memory File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long availableBlocks = stat.getAvailableBlocks(); romInfo[1] = blockSize * availableBlocks; getVersion(); return romInfo; } public long getTotalInternalMemorySize() { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); return totalBlocks * blockSize; } public long[] getSDCardMemory() { long[] sdCardInfo=new long[2]; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { File sdcardDir = Environment.getExternalStorageDirectory(); StatFs sf = new StatFs(sdcardDir.getPath()); long bSize = sf.getBlockSize(); long bCount = sf.getBlockCount(); long availBlocks = sf.getAvailableBlocks(); sdCardInfo[0] = bSize * bCount;//总大小 sdCardInfo[1] = bSize * availBlocks;//可用大小 } return sdCardInfo; } public void getTotalMemory() { String str1 = "/proc/meminfo"; String str2=""; try { FileReader fr = new FileReader(str1); BufferedReader localBufferedReader = new BufferedReader(fr, 8192); while ((str2 = localBufferedReader.readLine()) != null) { Log.i(TAG, "---" + str2); } } catch (IOException e) { } }
工程在附件里面
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2011-07-20
第一个下载的兄弟太不厚道了,
|
|
返回顶楼 | |
发表时间:2011-07-21
大师!谢谢分享。
|
|
返回顶楼 | |
发表时间:2011-07-21
不错, 谢谢分享
|
|
返回顶楼 | |
发表时间:2011-07-21
谢谢分享。。。
|
|
返回顶楼 | |
发表时间:2011-07-21
灰常感谢哈。
|
|
返回顶楼 | |
发表时间:2011-07-21
顶个~ 感谢分享。
|
|
返回顶楼 | |
发表时间:2011-07-21
谢谢分享!!
|
|
返回顶楼 | |
发表时间:2011-07-21
LZ大概完成了多少?1/3?1/5?
|
|
返回顶楼 | |
发表时间:2011-07-21
缺少那个j4lChartAndroid.jar包啊!
|
|
返回顶楼 | |