{"action":"created","comment":{"url":"https://api.github.com/repos/futurice/android-best-practices/pulls/comments/126332760","pull_request_review_id":48805129,"id":126332760,"diff_hunk":"@@ -415,39 +424,29 @@ Even if you don't witness this explicitly in a layout file, it might end up happ\n \n A couple of problems may occur. You might experience performance problems, because there is a complex UI tree that the processor needs to handle. Another more serious issue is a possibility of [StackOverflowError](http://stackoverflow.com/questions/2762924/java-lang-stackoverflow-error-suspected-too-many-views).\n \n-Therefore, try to keep your views hierarchy as flat as possible: learn how to use [RelativeLayout](https://developer.android.com/guide/topics/ui/layout/relative.html), how to [optimize your layouts](http://developer.android.com/training/improving-layouts/optimizing-layout.html) and to use the [`<merge>` tag](http://stackoverflow.com/questions/8834898/what-is-the-purpose-of-androids-merge-tag-in-xml-layouts).\n+Therefore, try to keep your views hierarchy as flat as possible: learn how to use [ConstraintLayout](https://developer.android.com/training/constraint-layout/index.html), how to [optimize your layouts](http://developer.android.com/training/improving-layouts/optimizing-layout.html) and to use the [`<merge>` tag](http://stackoverflow.com/questions/8834898/what-is-the-purpose-of-androids-merge-tag-in-xml-layouts).\n \n <a name=\"webviews\"></a>\n-**Beware of problems related to WebViews.** When you must display a web page, for instance for a news article, avoid doing client-side processing to clean the HTML, rather ask for a \"*pure*\" HTML from the backend programmers. [WebViews can also leak memory](http://stackoverflow.com/questions/3130654/memory-leak-in-webview) when they keep a reference to their Activity, instead of being bound to the ApplicationContext. Avoid using a WebView for simple texts or buttons, prefer TextViews or Buttons.\n+**Beware of problems related to WebViews.** When you must display a web page, for instance for a news article, avoid doing client-side processing to clean the HTML, rather ask for a \"*pure*\" HTML from the backend programmers. [WebViews can also leak memory](http://stackoverflow.com/questions/3130654/memory-leak-in-webview) when they keep a reference to their Activity, instead of being bound to the ApplicationContext. Avoid using a WebView for simple texts or buttons, prefer the platform's widgets.\n \n \n-### Test frameworks\n+### Test Frameworks\n \n-Android SDK's testing framework is still infant, specially regarding UI tests. Android Gradle currently implements a test task called [`connectedAndroidTest`](http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Testing) which runs JUnit tests that you created, using an [extension of JUnit with helpers for Android](http://developer.android.com/reference/android/test/package-summary.html). This means you will need to run tests connected to a device, or an emulator. Follow the official guide [[1]](http://developer.android.com/tools/testing/testing_android.html) [[2]](http://developer.android.com/tools/testing/activity_test.html) for testing.\n+**Use [JUnit](https://developer.android.com/training/testing/unit-testing/local-unit-tests.html) for unit testing** Plain, Android dependency-free unit testing on the JVM is best done using [Junit](https://junit.org). \n \n-**Use [Robolectric](http://robolectric.org/) only for unit tests, not for views.** It is a test framework seeking to provide tests \"disconnected from device\" for the sake of development speed, suitable specially for unit tests on models and view models. However, testing under Robolectric is inaccurate and incomplete regarding UI tests. You will have problems testing UI elements related to animations, dialogs, etc, and this will be complicated by the fact that you are \"walking in the dark\" (testing without seeing the screen being controlled).\n+**Avoid [Robolectric](http://robolectric.org/)** Prior to the improved support for JUnit in the Android build system, Robolectric was promoted as a test framework seeking to provide tests \"disconnected from device\" for the sake of development speed. However, testing under Robolectric is inaccurate and incomplete as it works by providing mock implementations of the Android platform, which provides no guarantees of correctness. Instead, use a combination of JVM based unit tests and dedicated on-device integration tests.","path":"README.md","position":113,"original_position":113,"commit_id":"726159e477c0af3b839ce17396bd90e4140a8b9f","original_commit_id":"726159e477c0af3b839ce17396bd90e4140a8b9f","user":{"login":"tomaszpolanski","id":1532227,"avatar_url":"https://avatars2.githubusercontent.com/u/1532227?v=3","gravatar_id":"","url":"https://api.github.com/users/tomaszpolanski","html_url":"https://github.com/tomaszpolanski","followers_url":"https://api.github.com/users/tomaszpolanski/followers","following_url":"https://api.github.com/users/tomaszpolanski/following{/other_user}","gists_url":"https://api.github.com/users/tomaszpolanski/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaszpolanski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaszpolanski/subscriptions","organizations_url":"https://api.github.com/users/tomaszpolanski/orgs","repos_url":"https://api.github.com/users/tomaszpolanski/repos","events_url":"https://api.github.com/users/tomaszpolanski/events{/privacy}","received_events_url":"https://api.github.com/users/tomaszpolanski/received_events","type":"User","site_admin":false},"body":"Small change of opinion :D","created_at":"2017-07-10T04:19:52Z","updated_at":"2017-07-10T04:23:39Z","html_url":"https://github.com/futurice/android-best-practices/pull/145#discussion_r126332760","pull_request_url":"https://api.github.com/repos/futurice/android-best-practices/pulls/145","_links":{"self":{"href":"https://api.github.com/repos/futurice/android-best-practices/pulls/comments/126332760"},"html":{"href":"https://github.com/futurice/android-best-practices/pull/145#discussion_r126332760"},"pull_request":{"href":"https://api.github.com/repos/futurice/android-best-practices/pulls/145"}}},"pull_request":{"url":"https://api.github.com/repos/futurice/android-best-practices/pulls/145","id":128955121,"html_url":"https://github.com/futurice/android-best-practices/pull/145","diff_url":"https://github.com/futurice/android-best-practices/pull/145.diff","patch_url":"https://github.com/futurice/android-best-practices/pull/145.patch","issue_url":"https://api.github.com/repos/futurice/android-best-practices/issues/145","number":145,"state":"open","locked":false,"title":"Various updates to old recommendations","user":{"login":"peter-tackage","id":1025059,"avatar_url":"https://avatars0.githubusercontent.com/u/1025059?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-tackage","html_url":"https://github.com/peter-tackage","followers_url":"https://api.github.com/users/peter-tackage/followers","following_url":"https://api.github.com/users/peter-tackage/following{/other_user}","gists_url":"https://api.github.com/users/peter-tackage/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-tackage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-tackage/subscriptions","organizations_url":"https://api.github.com/users/peter-tackage/orgs","repos_url":"https://api.github.com/users/peter-tackage/repos","events_url":"https://api.github.com/users/peter-tackage/events{/privacy}","received_events_url":"https://api.github.com/users/peter-tackage/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-05T12:50:05Z","updated_at":"2017-07-10T04:23:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d86e41a73adec2ce3f08c09eb019054e317317b","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/futurice/android-best-practices/pulls/145/commits","review_comments_url":"https://api.github.com/repos/futurice/android-best-practices/pulls/145/comments","review_comment_url":"https://api.github.com/repos/futurice/android-best-practices/pulls/comments{/number}","comments_url":"https://api.github.com/repos/futurice/android-best-practices/issues/145/comments","statuses_url":"https://api.github.com/repos/futurice/android-best-practices/statuses/726159e477c0af3b839ce17396bd90e4140a8b9f","head":{"label":"futurice:fix/various-updates-to-old-recommendations","ref":"fix/various-updates-to-old-recommendations","sha":"726159e477c0af3b839ce17396bd90e4140a8b9f","user":{"login":"futurice","id":852157,"avatar_url":"https://avatars1.githubusercontent.com/u/852157?v=3","gravatar_id":"","url":"https://api.github.com/users/futurice","html_url":"https://github.com/futurice","followers_url":"https://api.github.com/users/futurice/followers","following_url":"https://api.github.com/users/futurice/following{/other_user}","gists_url":"https://api.github.com/users/futurice/gists{/gist_id}","starred_url":"https://api.github.com/users/futurice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/futurice/subscriptions","organizations_url":"https://api.github.com/users/futurice/orgs","repos_url":"https://api.github.com/users/futurice/repos","events_url":"https://api.github.com/users/futurice/events{/privacy}","received_events_url":"https://api.github.com/users/futurice/received_events","type":"Organization","site_admin":false},"repo":{"id":22374063,"name":"android-best-practices","full_name":"futurice/android-best-practices","owner":{"login":"futurice","id":852157,"avatar_url":"https://avatars1.githubusercontent.com/u/852157?v=3","gravatar_id":"","url":"https://api.github.com/users/futurice","html_url":"https://github.com/futurice","followers_url":"https://api.github.com/users/futurice/followers","following_url":"https://api.github.com/users/futurice/following{/other_user}","gists_url":"https://api.github.com/users/futurice/gists{/gist_id}","starred_url":"https://api.github.com/users/futurice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/futurice/subscriptions","organizations_url":"https://api.github.com/users/futurice/orgs","repos_url":"https://api.github.com/users/futurice/repos","events_url":"https://api.github.com/users/futurice/events{/privacy}","received_events_url":"https://api.github.com/users/futurice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/futurice/android-best-practices","description":"Do's and Don'ts for Android development, by Futurice developers","fork":false,"url":"https://api.github.com/repos/futurice/android-best-practices","forks_url":"https://api.github.com/repos/futurice/android-best-practices/forks","keys_url":"https://api.github.com/repos/futurice/android-best-practices/keys{/key_id}","collaborators_url":"https://api.github.com/repos/futurice/android-best-practices/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/futurice/android-best-practices/teams","hooks_url":"https://api.github.com/repos/futurice/android-best-practices/hooks","issue_events_url":"https://api.github.com/repos/futurice/android-best-practices/issues/events{/number}","events_url":"https://api.github.com/repos/futurice/android-best-practices/events","assignees_url":"https://api.github.com/repos/futurice/android-best-practices/assignees{/user}","branches_url":"https://api.github.com/repos/futurice/android-best-practices/branches{/branch}","tags_url":"https://api.github.com/repos/futurice/android-best-practices/tags","blobs_url":"https://api.github.com/repos/futurice/android-best-practices/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/futurice/android-best-practices/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/futurice/android-best-practices/git/refs{/sha}","trees_url":"https://api.github.com/repos/futurice/android-best-practices/git/trees{/sha}","statuses_url":"https://api.github.com/repos/futurice/android-best-practices/statuses/{sha}","languages_url":"https://api.github.com/repos/futurice/android-best-practices/languages","stargazers_url":"https://api.github.com/repos/futurice/android-best-practices/stargazers","contributors_url":"https://api.github.com/repos/futurice/android-best-practices/contributors","subscribers_url":"https://api.github.com/repos/futurice/android-best-practices/subscribers","subscription_url":"https://api.github.com/repos/futurice/android-best-practices/subscription","commits_url":"https://api.github.com/repos/futurice/android-best-practices/commits{/sha}","git_commits_url":"https://api.github.com/repos/futurice/android-best-practices/git/commits{/sha}","comments_url":"https://api.github.com/repos/futurice/android-best-practices/comments{/number}","issue_comment_url":"https://api.github.com/repos/futurice/android-best-practices/issues/comments{/number}","contents_url":"https://api.github.com/repos/futurice/android-best-practices/contents/{+path}","compare_url":"https://api.github.com/repos/futurice/android-best-practices/compare/{base}...{head}","merges_url":"https://api.github.com/repos/futurice/android-best-practices/merges","archive_url":"https://api.github.com/repos/futurice/android-best-practices/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/futurice/android-best-practices/downloads","issues_url":"https://api.github.com/repos/futurice/android-best-practices/issues{/number}","pulls_url":"https://api.github.com/repos/futurice/android-best-practices/pulls{/number}","milestones_url":"https://api.github.com/repos/futurice/android-best-practices/milestones{/number}","notifications_url":"https://api.github.com/repos/futurice/android-best-practices/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/futurice/android-best-practices/labels{/name}","releases_url":"https://api.github.com/repos/futurice/android-best-practices/releases{/id}","deployments_url":"https://api.github.com/repos/futurice/android-best-practices/deployments","created_at":"2014-07-29T09:09:44Z","updated_at":"2017-07-10T04:11:46Z","pushed_at":"2017-07-06T10:10:07Z","git_url":"git://github.com/futurice/android-best-practices.git","ssh_url":"git@github.com:futurice/android-best-practices.git","clone_url":"https://github.com/futurice/android-best-practices.git","svn_url":"https://github.com/futurice/android-best-practices","homepage":null,"size":553,"stargazers_count":14207,"watchers_count":14207,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2640,"mirror_url":null,"open_issues_count":12,"forks":2640,"open_issues":12,"watchers":14207,"default_branch":"master"}},"base":{"label":"futurice:master","ref":"master","sha":"0ff214ae15b74eb19f8471a2789b80f2e03a9bd4","user":{"login":"futurice","id":852157,"avatar_url":"https://avatars1.githubusercontent.com/u/852157?v=3","gravatar_id":"","url":"https://api.github.com/users/futurice","html_url":"https://github.com/futurice","followers_url":"https://api.github.com/users/futurice/followers","following_url":"https://api.github.com/users/futurice/following{/other_user}","gists_url":"https://api.github.com/users/futurice/gists{/gist_id}","starred_url":"https://api.github.com/users/futurice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/futurice/subscriptions","organizations_url":"https://api.github.com/users/futurice/orgs","repos_url":"https://api.github.com/users/futurice/repos","events_url":"https://api.github.com/users/futurice/events{/privacy}","received_events_url":"https://api.github.com/users/futurice/received_events","type":"Organization","site_admin":false},"repo":{"id":22374063,"name":"android-best-practices","full_name":"futurice/android-best-practices","owner":{"login":"futurice","id":852157,"avatar_url":"https://avatars1.githubusercontent.com/u/852157?v=3","gravatar_id":"","url":"https://api.github.com/users/futurice","html_url":"https://github.com/futurice","followers_url":"https://api.github.com/users/futurice/followers","following_url":"https://api.github.com/users/futurice/following{/other_user}","gists_url":"https://api.github.com/users/futurice/gists{/gist_id}","starred_url":"https://api.github.com/users/futurice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/futurice/subscriptions","organizations_url":"https://api.github.com/users/futurice/orgs","repos_url":"https://api.github.com/users/futurice/repos","events_url":"https://api.github.com/users/futurice/events{/privacy}","received_events_url":"https://api.github.com/users/futurice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/futurice/android-best-practices","description":"Do's and Don'ts for Android development, by Futurice developers","fork":false,"url":"https://api.github.com/repos/futurice/android-best-practices","forks_url":"https://api.github.com/repos/futurice/android-best-practices/forks","keys_url":"https://api.github.com/repos/futurice/android-best-practices/keys{/key_id}","collaborators_url":"https://api.github.com/repos/futurice/android-best-practices/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/futurice/android-best-practices/teams","hooks_url":"https://api.github.com/repos/futurice/android-best-practices/hooks","issue_events_url":"https://api.github.com/repos/futurice/android-best-practices/issues/events{/number}","events_url":"https://api.github.com/repos/futurice/android-best-practices/events","assignees_url":"https://api.github.com/repos/futurice/android-best-practices/assignees{/user}","branches_url":"https://api.github.com/repos/futurice/android-best-practices/branches{/branch}","tags_url":"https://api.github.com/repos/futurice/android-best-practices/tags","blobs_url":"https://api.github.com/repos/futurice/android-best-practices/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/futurice/android-best-practices/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/futurice/android-best-practices/git/refs{/sha}","trees_url":"https://api.github.com/repos/futurice/android-best-practices/git/trees{/sha}","statuses_url":"https://api.github.com/repos/futurice/android-best-practices/statuses/{sha}","languages_url":"https://api.github.com/repos/futurice/android-best-practices/languages","stargazers_url":"https://api.github.com/repos/futurice/android-best-practices/stargazers","contributors_url":"https://api.github.com/repos/futurice/android-best-practices/contributors","subscribers_url":"https://api.github.com/repos/futurice/android-best-practices/subscribers","subscription_url":"https://api.github.com/repos/futurice/android-best-practices/subscription","commits_url":"https://api.github.com/repos/futurice/android-best-practices/commits{/sha}","git_commits_url":"https://api.github.com/repos/futurice/android-best-practices/git/commits{/sha}","comments_url":"https://api.github.com/repos/futurice/android-best-practices/comments{/number}","issue_comment_url":"https://api.github.com/repos/futurice/android-best-practices/issues/comments{/number}","contents_url":"https://api.github.com/repos/futurice/android-best-practices/contents/{+path}","compare_url":"https://api.github.com/repos/futurice/android-best-practices/compare/{base}...{head}","merges_url":"https://api.github.com/repos/futurice/android-best-practices/merges","archive_url":"https://api.github.com/repos/futurice/android-best-practices/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/futurice/android-best-practices/downloads","issues_url":"https://api.github.com/repos/futurice/android-best-practices/issues{/number}","pulls_url":"https://api.github.com/repos/futurice/android-best-practices/pulls{/number}","milestones_url":"https://api.github.com/repos/futurice/android-best-practices/milestones{/number}","notifications_url":"https://api.github.com/repos/futurice/android-best-practices/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/futurice/android-best-practices/labels{/name}","releases_url":"https://api.github.com/repos/futurice/android-best-practices/releases{/id}","deployments_url":"https://api.github.com/repos/futurice/android-best-practices/deployments","created_at":"2014-07-29T09:09:44Z","updated_at":"2017-07-10T04:11:46Z","pushed_at":"2017-07-06T10:10:07Z","git_url":"git://github.com/futurice/android-best-practices.git","ssh_url":"git@github.com:futurice/android-best-practices.git","clone_url":"https://github.com/futurice/android-best-practices.git","svn_url":"https://github.com/futurice/android-best-practices","homepage":null,"size":553,"stargazers_count":14207,"watchers_count":14207,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2640,"mirror_url":null,"open_issues_count":12,"forks":2640,"open_issues":12,"watchers":14207,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/futurice/android-best-practices/pulls/145"},"html":{"href":"https://github.com/futurice/android-best-practices/pull/145"},"issue":{"href":"https://api.github.com/repos/futurice/android-best-practices/issues/145"},"comments":{"href":"https://api.github.com/repos/futurice/android-best-practices/issues/145/comments"},"review_comments":{"href":"https://api.github.com/repos/futurice/android-best-practices/pulls/145/comments"},"review_comment":{"href":"https://api.github.com/repos/futurice/android-best-practices/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/futurice/android-best-practices/pulls/145/commits"},"statuses":{"href":"https://api.github.com/repos/futurice/android-best-practices/statuses/726159e477c0af3b839ce17396bd90e4140a8b9f"}}}}
{"actor":{"display_login":"tomaszpolanski"}}