开发者

Android - get actual allocated RAM size

when I open new activities, I need to know my actual memory allocation (app can have huge memory allocation and I need to test real numbers). Is there any API for that?

Thanks

Edit code is not running... there is error on last line:

ActivityManager actvityManager = (ActivityManager) this.getSystemService( ACTIVITY_SERVICE );
    ActivityManager.MemoryInfo mInfo = new ActivityManager.MemoryInfo ();
    actvityManager.getMemoryInfo( mInfo );

    List<RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses();

    for(int i = 0; i < procInfos.size(); i++)
    {
        if(procInfos.get(i).processName.equals("cz.process.a")) {
            int  field[]=new int []{procInfos.get(i).pid};
            android.os.Debug.MemoryInfo[] info = actvityManager.getProces开发者_JAVA百科sMemoryInfo(field);

Still not solved. There was someone, who was an expert. But he offered me a code and wasn't able to describe it. He suggested code above, but on the last line there is a critical error.


I believe Debug and Debug.MemoryInfo classes can help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜