1. Check out our app, Forums for Android! Download and leave feedback here!

Create object for ActivityManager

Discussion in 'Application Development' started by saranya, Oct 31, 2008.

  1. saranya

    saranya Member
    Thread Starter
    6

    Oct 17, 2008
    9
    1
    6
    I am trying to get memorystatus.For that i need to use method getMemoryInfo(ActvityManager.MemoryInfo).I can access it by using ActivityManager class only.But i can't make it out.Please help me to create object for activitymanager.And Can i get Total memory in emulator ?Or we can get it in mobile testing only.
    Thanks in advance
    saran
     

    Advertisement

  2. androidhelp

    androidhelp New Member
    5

    May 6, 2010
    1
    0
    5
    Hi,
    u can try following code:
    ActivityManager actvityManager = (ActivityManager) this.getSystemService( ACTIVITY_SERVICE );
    ActivityManager.MemoryInfo mInfo = new ActivityManager.MemoryInfo ();
    actvityManager.getMemoryInfo( mInfo );
    // Print to log and read in DDMS
    Log.i( "TAG", " minfo.availMem " + mInfo.availMem );
    Log.i( "TAG", " minfo.lowMemory " + mInfo.lowMemory );
    Log.i( "TAG", " minfo.threshold " + mInfo.threshold );

    It worked for me.
    Hope it helps u.
     

Share This Page

Loading...