Menu

#144 Slow operations in UI thread

New
nobody
None
Medium
Defect
2013-07-26
2013-07-26
Anonymous
No

Originally created by: yepang...@gmail.com

Dear developers,

I am studying APG using a static code checker. I found some potential slow operations in APG's UI thread.

Android documentation says this:

http://developer.android.com/training/articles/perf-anr.html

"Any method that runs in the UI thread should do as little work as possible on that thread. In particular, activities should do as little as possible in key life-cycle methods such as onCreate() and onResume(). Potentially long running operations such as network or database operations, or computationally expensive calculations such as resizing bitmaps should be done in a worker thread (e.g., via AsyncTask)."

I found the following event handler performing database queries and file IO:

org.thialfihar.android.apg.MainActivity's onCreate() and onCreateDialog() handlers: database queries and file IO
org.thialfihar.android.apg.KeyServerQueryActivity's onCreateDialog() handler: database queries and file IO
org.thialfihar.android.apg.PublicKeyListActivity's onContextItemSelected() handler: database queries and file IO
org.thialfihar.android.apg.KeyListActivity's onCreateDialog() handler: database queries and file IO
org.thialfihar.android.apg.BaseActivity's onCreateDialog() handler: database queries and file IO
org.thialfihar.android.apg.DecryptActivity's onCreateDialog() handler: database queries
org.thialfihar.android.apg.EditKeyActivity's onCreate() and onCreateDialog() handlers: database queries and file IO
org.thialfihar.android.apg.EncryptActivity's onCreate(), onCreateDialog() and onActivityResult() handlers: database queries and file IO
org.thialfihar.android.apg.EncryptActivity's onClick() handlers at line 238 and line 244: database queries and file IO
org.thialfihar.android.apg.DecryptActivity's onClick() handlers at line 297 and line 303: database queries and file IO

Do you think these slow operations will affect APG's performance (e.g., making GUI not smooth enough)? If yes, perhaps moving them to a separate thread can help make APG super smooth in user interaction. Looking forward to your reply and hope I can help improve APG.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB