Skip to Content
Pro Android Apps Performance Optimization
book

Pro Android Apps Performance Optimization

by Hervé Guihot
January 2012
Intermediate to advanced
282 pages
7h 4m
English
Apress
Content preview from Pro Android Apps Performance Optimization

APIs

Android defines several APIs you can use to learn about how much memory is available on the system and how much is being used:

  • ActivityManager'sgetMemoryInfo()
  • ActivityManager'sgetMemoryClass()
  • ActivityManager'sgetLargeMemoryClass()
  • Debug's dumpHprofData()
  • Debug's getMemoryInfo()
  • Debug's getNativeHeapAllocatedSize()
  • Debug's getNativeHeapSize()

TIP: Set android:largeHeap to true in your application's manifest file to use a large heap. This attribute was introduced in Android 3.0. Note that there is no guarantee the large heap is any larger than the regular heap. You should try hard to prevent your application from having to depend on this setting.

Listing 4–21 shows how to use the two getMemoryInfo() methods.

Listing 4–21. Calling

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Android High Performance Programming

Android High Performance Programming

Enrique López Mañas, Diego Grancini
Pro Android Graphics

Pro Android Graphics

Wallace Jackson

Publisher Resources

ISBN: 9781430239994Purchase book