-1

I have successfully found the available free RAM but i want to find Ram usage in MB for All running Applications.

I have tried this link but I am not able come up with Solution.

What kind of functionality would this require?

Community
  • 1
  • 1
Rajesh Jadav
  • 12,801
  • 5
  • 53
  • 78

2 Answers2

1

You can try to use dumpsys meminfo to get memory usage.

Process proc = Runtime.getRuntime().exec("");
BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
DataOutputStream out = new DataOutputStream(proc.getOutputStream());

// periodically execute dumpsys meminfo
out.writeBytes("dumpsys meminfo\n");
out.flush();

// read mem log and do some parsing job
while (reader.ready()) {
    line = reader.readLine();
    // you can parse the log
}
PageNotFound
  • 2,320
  • 2
  • 23
  • 34
0

here you go, Debug.MemoryInfo might rescue you, check out Android developer documentation here

Techfist
  • 4,314
  • 6
  • 22
  • 32