memory taken by processes show in graph or in list
<p>I'm using this to get memory taken by processes, please help me, I want to show taken memory by all other installed applications and want to show in graph</p>

<pre><code>public class MainActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ActivityManager activityManager = (ActivityManager) this
            .getSystemService(ACTIVITY_SERVICE);
    MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
    activityManager.getMemoryInfo(memoryInfo);

    Log.i("TAG", " memoryInfo.availMem " + memoryInfo.availMem + "\n");
    Log.i("TAG", " memoryInfo.lowMemory " + memoryInfo.lowMemory + "\n");
    Log.i("TAG", " memoryInfo.threshold " + memoryInfo.threshold + "\n");

    List&lt;RunningAppProcessInfo&gt; runningAppProcesses = activityManager
            .getRunningAppProcesses();

    Map&lt;Integer, String&gt; pidMap = new TreeMap&lt;Integer, String&gt;();
    for (RunningAppProcessInfo runningAppProcessInfo : runningAppProcesses) {
        pidMap.put(runningAppProcessInfo.pid,
                runningAppProcessInfo.processName);
    }

    Collection&lt;Integer&gt; keys = pidMap.keySet();

    for (int key : keys) {
        int pids[] = new int[1];
        pids[0] = key;
        android.os.Debug.MemoryInfo[] memoryInfoArray = activityManager
                .getProcessMemoryInfo(pids);
        for (android.os.Debug.MemoryInfo pidMemoryInfo : memoryInfoArray) {
            Log.i("TAG", String.format("** MEMINFO in pid %d [%s] **\n",
                    pids[0], pidMap.get(pids[0])));
            Log.i("TAG", " pidMemoryInfo.getTotalPrivateDirty(): "
                    + pidMemoryInfo.getTotalPrivateDirty() + "\n");
            Log.i("TAG",
                    " pidMemoryInfo.getTotalPss(): "
                            + pidMemoryInfo.getTotalPss() + "\n");
            Log.i("TAG", " pidMemoryInfo.getTotalSharedDirty(): "
                    + pidMemoryInfo.getTotalSharedDirty() + "\n");
        }
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}
</code></pre>

<p>}</p>
