Android - getting memory info ? (SOLVED- partially)
in
Android Processing
•
5 months ago
Hi
EDIT: Solved... also needed to create an ActivityManager. The code now shows me memory info although totalMem is still a problem... but one I can live with.
Anyone done any fiddling with memory management for android? I have just started but have hit a problem straight off!
In the code below, I am simply printing the MemoryInfo fields
The first 3 work, but the myMemInfo.totalMem field generates an error.
Also, any explanations as to why myMemInfo.availMem has the value zero?
Any ideas/thoughts?
- import android.app.ActivityManager.MemoryInfo ;
- import android.app.ActivityManager;
- MemoryInfo myMemInfo ;
- ActivityManager myActivityManager ;
- void setup(){
- myMemInfo = new MemoryInfo();
- myActivityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
- myActivityManager.getMemoryInfo(myMemInfo);
- println("availMem = " + myMemInfo.availMem);
- println("lowMemory = " + myMemInfo.lowMemory);
- println("threshold = " + myMemInfo.threshold);
- println("totalMemory = " + myMemInfo.totalMem);
- }
- void draw(){
- }
Cheers
Mark
1