How can i put this in a textview?
ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
memoryInfo.availMem;
the textview id is for example freemem
. The textview is in a second tab of a swipeview.thans
Put this in your layout XML
<TextView android:id="@+id/myTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
and this in your activity:
TextView myTextView = (TextView)findViewById(R.id.myTextView);
ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
myTextView.setText("" + memoryInfo.availMem);
memoryInfo.availMem is the available memory on the system. memoryInfo.totalMem is the total memory accessible by the kernel.
Here is a link to a good answer about memory availability.