public void update() {
   mMemInfoReader.readMemInfo();
   long free = mMemInfoReader.getFreeSize() + mMemInfoReader.getCachedSize();
   long used = mMemInfoReader.getTotalSize() - free;
   mMemFree.setText(String.format("%d MB", free / 1048576));
   mMemUsed.setText(String.format("%d MB", used / 1048576));
   if (DEBUG) Slog.i(TAG, String.format("Memory: %d/%d", free, free + used));
   mBarGraphView.setLevels(free, used);
   mBarGraphView.invalidate();
   mMemFree.invalidate();
   mMemUsed.invalidate();
 }
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    final Context context = getContext();
    mMemFree = (TextView) findViewById(R.id.free_memory);
    mMemUsed = (TextView) findViewById(R.id.used_memory);
    mBarGraphView = (BarGraphView) findViewById(R.id.bar_graph);

    mMemInfoReader.readMemInfo();
    long free = mMemInfoReader.getFreeSize() + mMemInfoReader.getCachedSize();
    long used = mMemInfoReader.getTotalSize() - free;
    mMemFree.setText(String.format("%d MB", free / 1048576));
    mMemUsed.setText(String.format("%d MB", used / 1048576));
    if (DEBUG) Slog.i(TAG, String.format("Memory: %d/%d", free, free + used));
    mBarGraphView.setLevels(free, used);
  }