android-samples icon indicating copy to clipboard operation
android-samples copied to clipboard

Network operations on UI Thread

Open mamert opened this issue 7 years ago • 1 comments

Expected Behavior

I/O Operations do not block the UI Thread

Actual Behavior

Writing to file blocks UI

Steps to Reproduce the Problem

  1. Run app
  2. Click "Create a file"
  3. Notice nothing, as this is only visible with larger files. But add a Thread.sleep(10000) near the OutputStream code and you will get a "Not Responding"

I'm not reporting a bug, just offering to contribute. Guidelines require that I submit an issue first.

Use samples benefit from brevity, but it would be good not to teach bad habits.

I have a patch ready for submission, if you approve.

It just copies CreateFileActivity with small changes, showing 2 ways to address this.

mamert avatar Oct 03 '18 13:10 mamert

@asrivas - Can you please take a look?

erickoledadevrel avatar Oct 15 '18 19:10 erickoledadevrel