{"action":"closed","issue":{"url":"https://api.github.com/repos/cgeo/cgeo/issues/3054","labels_url":"https://api.github.com/repos/cgeo/cgeo/issues/3054/labels{/name}","comments_url":"https://api.github.com/repos/cgeo/cgeo/issues/3054/comments","events_url":"https://api.github.com/repos/cgeo/cgeo/issues/3054/events","html_url":"https://github.com/cgeo/cgeo/issues/3054","id":17211694,"number":3054,"title":"Performance improvement suggestion","user":{"login":"andrew659","id":697555,"avatar_url":"https://avatars.githubusercontent.com/u/697555?v=3","gravatar_id":"","url":"https://api.github.com/users/andrew659","html_url":"https://github.com/andrew659","followers_url":"https://api.github.com/users/andrew659/followers","following_url":"https://api.github.com/users/andrew659/following{/other_user}","gists_url":"https://api.github.com/users/andrew659/gists{/gist_id}","starred_url":"https://api.github.com/users/andrew659/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrew659/subscriptions","organizations_url":"https://api.github.com/users/andrew659/orgs","repos_url":"https://api.github.com/users/andrew659/repos","events_url":"https://api.github.com/users/andrew659/events{/privacy}","received_events_url":"https://api.github.com/users/andrew659/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cgeo/cgeo/labels/Feedback","name":"Feedback","color":"FAB028"},{"url":"https://api.github.com/repos/cgeo/cgeo/labels/Refactoring","name":"Refactoring","color":"e102d8"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2013-07-25T13:40:47Z","updated_at":"2015-01-02T14:45:35Z","closed_at":"2015-01-02T14:45:35Z","body":"Dear developers,\r\n\r\nI am analyzing cgeo using a static code checker. I found some potential slow operations in cgeo's UI thread.\r\n\r\nAndroid documentation says this:\r\n\r\nhttp://developer.android.com/training/articles/perf-anr.html\r\n\r\n\"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(). 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).\"\r\n\r\nI found the following event handlers transitively performing database queries, touching file systems, or compressing bitmaps:\r\n\r\ncgeo.geocaching.ImageSelectActivity.onActivityResult()\r\ncgeo.geocaching.CacheDetailActivity$DescriptionViewCreator's onClick() handler at line 1644 (revision 6e4a8d4ba8)\r\ncgeo.geocaching.MainActivity's onLongClick() handler at line 362\r\ncgeo.geocaching.CacheDetaiActivity$DescriptionViewCreator's onClick() handler at line 1797\r\ncgeo.geocaching.ui.ImagesList$AsyncImgLoader onClick() listener at line 132\r\ncgeo.geocaching.LogCacheActivity's onClick() handler at line 323\r\ncgeo.geocaching.LogCacheActivity's onClick() handler at line 332\r\n\r\nDo you think these slow operations will affect cgeo's performance (e.g., make GUI not smooth enough)? If yes, perhaps moving them to a separate thread can help make cgeo super smooth in user interaction. Looking forward to your reply and hope I can help improve cgeo.\r\n"}}