runox
Affiliate Deal Closer
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
This is my other tutorial on how to find and display your available memory, used memory, and total memory in your phone.
Since Android devices are usually battery-powered, Android is designed to manage memory (RAM) to keep power consumption at a minimum, in contrast to desktop operating systems which generally assume they are connected to unlimited mains electricity. When an Android app is no longer in use, the system will automatically suspend it in memory – while the app is still technically "open", suspended apps consume no resources and sit idly in the background until needed again. This has the dual benefit of increasing the general responsiveness of Android devices, since apps don't need to be closed and reopened from scratch each time, but also ensuring background apps don't consume power needlessly. Thus, it is really important to manage our memory in Android phones.
On this, you need to create Three Labels and named it as "lblAvail" for displaying the Available Memory, "lblTotal" for displaying the Total Memory, and "lblUsed" for displaying the Used Memory. You need also to create one button and named it btnMemory to display all of this memory in one. Next, named your abstract design as "main". Your abstract designer will be like this one below:
Declare your variable in the Sub_Global like this:
Dim
ph As
ICOSPhone
- ph here is our variable for ICOSPhone in which it has all the necessary libraries in using phone utilities.
Dim
lblAvail As
Label
- we use this label to display the the Available Memory of your phone.
Dim
lblTotal As
Label
- we use this label to display the the Total Memory of your phone.
Dim
lblUsed As
Label
- we use this label to display the the Used Memory of your phone.
Now create a new activity. It should look like this:
Now your activity when run will look like this below:
Next, type the following code below. That this code means to display the all the values of our memory when our btnMemory is click.
The ph.UsedMemory here is the method used to display the Used Memory, ph.AvailMemory for displaying Available Memory, and ph.TotalMemory for displaying Total Memory.
When you click this button, it will display like this image below:
Here's the full code for this tutorial:
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
STI College - Surigao City
Mobile: 09488225971
E-mail:[email protected]
Follow and add me in my Facebook Account: https://www.facebook.com/donzzsky
Download
Since Android devices are usually battery-powered, Android is designed to manage memory (RAM) to keep power consumption at a minimum, in contrast to desktop operating systems which generally assume they are connected to unlimited mains electricity. When an Android app is no longer in use, the system will automatically suspend it in memory – while the app is still technically "open", suspended apps consume no resources and sit idly in the background until needed again. This has the dual benefit of increasing the general responsiveness of Android devices, since apps don't need to be closed and reopened from scratch each time, but also ensuring background apps don't consume power needlessly. Thus, it is really important to manage our memory in Android phones.
On this, you need to create Three Labels and named it as "lblAvail" for displaying the Available Memory, "lblTotal" for displaying the Total Memory, and "lblUsed" for displaying the Used Memory. You need also to create one button and named it btnMemory to display all of this memory in one. Next, named your abstract design as "main". Your abstract designer will be like this one below:

Declare your variable in the Sub_Global like this:
- Sub
Globals
- 'These global variables will be redeclared each time the activity is created.
- 'These variables can only be accessed from this module.
- Dim
ph As
ICOSPhone
- Dim
btnMemory As
Button
- Dim
lblAvail As
Label
- Dim
lblTotal As
Label
- Dim
lblUsed As
Label
- End
Sub
Dim
ph As
ICOSPhone
- ph here is our variable for ICOSPhone in which it has all the necessary libraries in using phone utilities.
Dim
lblAvail As
Label
- we use this label to display the the Available Memory of your phone.
Dim
lblTotal As
Label
- we use this label to display the the Total Memory of your phone.
Dim
lblUsed As
Label
- we use this label to display the the Used Memory of your phone.
Now create a new activity. It should look like this:
- Sub
Activity_Create(FirstTime As
Boolean
)
- 'Do not forget to load the layout file created with the visual designer. For example:
- Activity.LoadLayout("main"
)
- End
Sub
Now your activity when run will look like this below:

Next, type the following code below. That this code means to display the all the values of our memory when our btnMemory is click.
- Sub
btnMemory_Click
- lblUsed.Text = ph.UsedMemory
- lblAvail.Text = ph.AvailMemory
- lblTotal.Text = ph.TotalMemory
- End
Sub
The ph.UsedMemory here is the method used to display the Used Memory, ph.AvailMemory for displaying Available Memory, and ph.TotalMemory for displaying Total Memory.
When you click this button, it will display like this image below:

Here's the full code for this tutorial:
- Sub
Process_Globals
- 'These global variables will be declared once when the application starts.
- 'These variables can be accessed from all modules.
- End
Sub
- Sub
Globals
- 'These global variables will be redeclared each time the activity is created.
- 'These variables can only be accessed from this module.
- Dim
ph As
ICOSPhone
- Dim
btnMemory As
Button
- Dim
lblAvail As
Label
- Dim
lblTotal As
Label
- Dim
lblUsed As
Label
- End
Sub
- Sub
Activity_Create(FirstTime As
Boolean
)
- 'Do not forget to load the layout file created with the visual designer. For example:
- Activity.LoadLayout("main"
)
- End
Sub
- Sub
Activity_Resume
- End
Sub
- Sub
Activity_Pause (UserClosed As
Boolean
)
- End
Sub
- Sub
btnMemory_Click
- lblUsed.Text = ph.UsedMemory
- lblAvail.Text = ph.AvailMemory
- lblTotal.Text = ph.TotalMemory
- End
Sub
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
STI College - Surigao City
Mobile: 09488225971
E-mail:[email protected]
Follow and add me in my Facebook Account: https://www.facebook.com/donzzsky
Download
You must upgrade your account or reply in the thread to view hidden text.