Android Utility May 2026

<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> <Button android:id="@+id/btnClearCache" android:text="Clear App Cache" ... />

<uses-permission android:name="android.permission.CLEAR_APP_CACHE" /> <uses-permission android:name="android.permission.BATTERY_STATS" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> : Starting with Android 11, CLEAR_APP_CACHE is restricted for third‑party apps. You'll need to use the Storage Access Framework or guide users to system settings. For this demo, we'll handle it gracefully. Step 3: Build the Main UI Create a simple activity_main.xml with three buttons and a TextView for results: android utility

Every Android developer, at some point, finds themselves repeating the same tasks: clearing cache, checking battery stats, or toggling settings quickly. That's where building a utility app comes in. For this demo, we'll handle it gracefully

<TextView android:id="@+id/tvResult" android:layout_marginTop="24dp" ... /> </LinearLayout> In your MainActivity.kt , add the following: 4.1 Clear App Cache (Limited – See Note) private fun clearCache() { try { val cacheDir = cacheDir cacheDir.deleteRecursively() tvResult.text = "✓ App cache cleared (${formatSize(cacheDir.totalSpace - cacheDir.freeSpace)})" } catch (e: Exception) { tvResult.text = "❌ Failed: ${e.message}" } } Important : On modern Android, you cannot clear other apps’ caches without root or special system permissions. This clears only your own app’s cache – a safe starting point. 4.2 Battery Health Checker private fun getBatteryStatus(): String { val batteryManager = getSystemService(BATTERY_SERVICE) as BatteryManager val level = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY) val status = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_STATUS) val statusText = when (status) { BatteryManager.BATTERY_STATUS_CHARGING -> "Charging" BatteryManager.BATTERY_STATUS_DISCHARGING -> "Discharging" BatteryManager.BATTERY_STATUS_FULL -> "Full" else -> "Unknown" } return "🔋 Battery: $level% ($statusText)" } 4.3 Storage Analyzer private fun getStorageInfo(): String { val stat = StatFs(Environment.getDataDirectory().path) val blockSize = stat.blockSizeLong val totalBlocks = stat.blockCountLong val availableBlocks = stat.availableBlocksLong val total = totalBlocks * blockSize val available = availableBlocks * blockSize val used = total - available "Charging" BatteryManager.BATTERY_STATUS_DISCHARGING -&gt

<Button android:id="@+id/btnBatteryStatus" android:text="Check Battery" ... />

Add these dependencies in your build.gradle.kts (Module):