In that tutorial, you are going to discover how to get Memory Information concerning a smartphone or tablet on Android.
In an Android application, you can get information concerning :
These information can be retrieved via two objects of the Android Standard SDK : MemoryInfo and Runtime.
Note that you can discover this tutorial in video on YouTube :
First, we need to create a simple user interface to display the memory information on the screen. This UI will consist of a TextView centered on the main layout.
Now, we can write the Java code of the Main Activity to get Memory Information. First, we create a MemoryInfo object in which we load the memory information by calling the getMemoryInfo method of the ActivityManager system service.
Then, we get the instance of the Runtime object by calling the getRuntime method of the Runtime object. Last step is just to format all these information and return that to display them on the screen.
That gives us the following code :
<a href="https://medium.com/media/34e5078a2e6f109184715b00a5645268/href">https://medium.com/media/34e5078a2e6f109184715b00a5645268/href</a>
By running the application, we can enjoy the memory information displayed on the screen :
That’s all for that tutorial. To discover more tutorials on Android Development, don’t hesitate to subscribe to the SSaurel’s Channel.
You can also visit the SSaurel’s Blog : https://www.ssaurel.com/blog