• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Create object for ActivityManager

saranya

Lurker
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
 
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

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.
 
Back
Top Bottom