Blocking operations are those operations that force the app to wait for a result before being able to move on to the next operation. Executing a blocking operation on the UI thread will force the UI to freeze, and this will produce a bad user experience.
After we have enabled StrictMode
, we start receiving unpleasant messages about how our app is doing badly on disk I/O:
D/StrictMode﹕ StrictMode policy violation; ~duration=998 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=31 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk (StrictMode.java:1135) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:106) at libcore.io.IoBridge.open(IoBridge.java:393) at java.io.FileOutputStream.<init>(FileOutputStream.java:88) at android.app.ContextImpl.openFileOutput(ContextImpl.java:918) at android.content.ContextWrapper.openFileOutput(ContextWrapper. java:185) at com.packtpub.apps...