New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
put file access into background thread? #6
Conversation
--HG-- extra : rebase_source : a36ee9b7c46f8578354f957a354350fe6d2c0d16
…ter switching subscriptions
--HG-- extra : rebase_source : b1ca47da9bcb985fce0193e3b2b2f7a6aa31ee09
--HG-- extra : amend_source : 7e37389f6817b5640db90295cc2bcda3b5cc5f25
put disk access to background thread.
put disk access to background thread.
I sent this pr several days ago. Any idea/comments? |
@rjeschke, could you have a look? |
In this case, the responsiveness issues don't originate from the disc access, but you're right, Android rules are: no IO on the UI thread. Your changes to The changes you did to Solutions I see for this issue are:
|
Nice to hear from you. I fix the indentation in The first solution you propose can work (just invoke But I don't quite understand the second solution. It still needs to wait the |
The two points I specified were two different solutions. If we choose point 1 (blocking), then there's no need to change the original code, as both solutions would block the UI thread (and not may block, but definitely block). The second solution (delay/2nd async task) would be the clean solution as it makes the whole startup process asynchronous (though it does require a lot more code changes). |
For the first solution, we still get some concurrency between the async task and For the second solution, I still don't understand your thought based on your short description, so I can't do any change for it right now. How about I remove the changes in |
I remove the second async refactoring so you can merge the one in |
Hi, I'm doing research on performance for Android apps. I found two event handlers access disk (read/write files) from UI thread, but Android docs suggest us to avoid blocking calls in UI thread. Do you think they may lead to any responsiveness issues?
I tried to refactoring by putting them into AsyncTask. Looking forward to see your comments.