This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Android and the fly likes how to get memory size in android phone Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "how to get memory size in android phone" Watch "how to get memory size in android phone" New topic
Author

how to get memory size in android phone

sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
I need to know the memory size of my phone.I used below
Runtime.getRuntime().totalMemory()/1024*1024
But it gives me 5 as result.It can't be.because my phone mmemory is larger than 5 MB.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
I'm not aware of an API call for that. The info contained in /proc/cpuinfo and /proc/meminfo (which you can read via "cat" executed through Runtime.exec) probably has everything you need.


Ping & DNS - my free Android networking tools app
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
actually i need to get memory details like totsl memory,remaining memory ... in MB or GB.
I need to show them in my app.So its better to get them as a String or text value.s there a way to do this ?
i mean calling a method .... like that ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
Again: if you're after an existing API call, then I don't think there is one.

But with the information I gave you it's easy to write a method that extracts the information you're after. Have you looked at the contents of those files yet? If not, then that should be your next step.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get memory size in android phone
 
Similar Threads
Need to Calculate folder size
java.lang.OutOfMemoryError: PermGen space
JVM memory use
nio performance issue
How to pass the values between MIDlets?