Calculates the total memory of the device. This is based on an inspection of the filesystem, which in android devices is stored in RAM. : Memory « Hardware « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Hardware » Memory 
Calculates the total memory of the device. This is based on an inspection of the filesystem, which in android devices is stored in RAM.
  
//package org.acra.util;

import java.io.File;


import android.content.Context;
import android.content.res.Configuration;
import android.os.Environment;
import android.os.StatFs;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;

/**
 * Responsible for providing base utilities used when constructing the report.
 * <p/>
 @author William Ferguson
 @since 4.3.0
 */
public final class ReportUtils {

    /**
     * Calculates the total memory of the device. This is based on an inspection of the filesystem, which in android
     * devices is stored in RAM.
     *
     @return Total number of bytes.
     */
    public static long getTotalInternalMemorySize() {
        final File path = Environment.getDataDirectory();
        final StatFs stat = new StatFs(path.getPath());
        final long blockSize = stat.getBlockSize();
        final long totalBlocks = stat.getBlockCount();
        return totalBlocks * blockSize;
    }




}

   
    
  
Related examples in the same category
1.Get memory information
2.Get Memory Size Strings
3.Get Used Memory Size
4.Get Free Memory Size
5.Get Total Memory Size
6.Calculates the free memory of the device. This is based on an inspection of the filesystem, which in android devices is stored in RAM.
7.Get Memory Total
8.Get Memory Free
9.get MemoryInfo
10.Memory information
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.