googleworkspace / android-samples

Android samples for Google Workspace APIs
Apache License 2.0
635 stars 410 forks source link

Network operations on UI Thread #96

Open mamert opened 5 years ago

mamert commented 5 years ago

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.

erickoledadevrel commented 5 years ago

@asrivas - Can you please take a look?