Android StrictMode
Tuesday, March 06, 2012, Modified: Tuesday, March 06, 2012 Refs

Have your app flag when slow things happen on the UI thread making it unresponsive and risking an ANR termination by the system.

if (DEVELOPER_MODE) {
    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
       .detectDiskReads()
       .detectDiskWrites()
       .detectNetwork()   // or .detectAll() for all detectable problems
       .penaltyLog()
       .build());
    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
       .detectLeakedSqlLiteObjects()
       .detectLeakedClosableObjects()
       .penaltyLog()
       .penaltyDeath()
       .build());
}
(From http://developer.android.com/reference/android/os/StrictMode.html)
This requires a target of Android 2.3+ (API level 9).

Try Buffer, a smarter way to share links and pictures by spreading your tweets and posts out over time. Sign up from this link and we both get extra features.

Buffer
Home :: Items