<Button android:id="@+id/btnBatteryStatus" android:text="Check Battery" ... />
Have you built a utility app before? Share your favorite tool or feature in the comments below! Happy coding! 🚀 android utility
return "📁 Storage:\nTotal: ${formatSize(total)}\nUsed: ${formatSize(used)}\nFree: ${formatSize(available)}" } Happy coding
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
<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:
Add these dependencies in your build.gradle.kts (Module):