{"id":21006865,"url":"https://github.com/frostyshadows/android-cheatsheet","last_synced_at":"2026-01-26T18:55:54.384Z","repository":{"id":127685795,"uuid":"266133134","full_name":"frostyshadows/android-cheatsheet","owner":"frostyshadows","description":"Helpful visual guides for Android development","archived":false,"fork":false,"pushed_at":"2025-01-05T02:13:25.000Z","size":6618,"stargazers_count":72,"open_issues_count":0,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-20T10:44:02.353Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frostyshadows.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-22T14:39:46.000Z","updated_at":"2025-01-17T04:20:28.000Z","dependencies_parsed_at":"2024-11-19T00:19:02.903Z","dependency_job_id":"f2d6e236-9ed7-433e-8cb6-b99a15e0211b","html_url":"https://github.com/frostyshadows/android-cheatsheet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostyshadows%2Fandroid-cheatsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostyshadows%2Fandroid-cheatsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostyshadows%2Fandroid-cheatsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostyshadows%2Fandroid-cheatsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frostyshadows","download_url":"https://codeload.github.com/frostyshadows/android-cheatsheet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243428421,"owners_count":20289315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T08:53:52.609Z","updated_at":"2026-01-26T18:55:49.339Z","avatar_url":"https://github.com/frostyshadows.png","language":null,"funding_links":[],"categories":["Misc"],"sub_categories":[],"readme":"# Android Cheatsheet\n\nThis is a collection of visual guides that I find myself coming back to repeatedly while doing Android development. Open to contributions!\n\n## Table of contents\n\n[Activities and Fragments](#activities-and-fragments)\n\n[User interface](#user-interface)\n\n[Kotlin](#kotlin)\n\n[Jetpack Compose](#jetpack-compose)\n\n[Architecture](#architecture)\n\n[Build process](#build-process)\n\n[General software engineering](#general-software-engineering)\n\n## Activities and Fragments\n\n### Lifecycle flowchart\n\n\u003cimg src=\"https://i2.wp.com/androhub.com/wp-content/uploads/2015/04/activity_lifecycle.png?resize=538%2C668\"\u003e\n\n### Callback methods\n\n|   Callback    |              When               |                         What                        |Is Activity visible|\n| --------------|---------------------------------|-----------------------------------------------------|:-----------------:|\n|onCreate()     | Activity is first created       | All the necessary UI elements should be initialized | no                |\n| onStart()     | Activity becomes visible to user| Code that maintains the UI, start async tasks (get data from API or database), register listeners                                                                           | yes               |\n| onResume()    | Activity becomes interactable to user| Starts animations                              | yes               |\n| onPause()     | User is leaving the activity     | Stops animations                                   |partially visible  |\n| onStop()      | Activity is no longer visible to user| Unregisters listeners and resources allocated in onStart()|no      |\n| onRestart()   | Activity in the stopped state is about to start again (on back click) | Cursor objects should be re-queried                                                                                                         | no                |\n| onDestroy()   | Activity is destroyed from memory|                                                    | no                |\n\n\n### Launch modes\n| Mode           | Default       | Instantiation      | New Task on Launch | Allow other activities within Task |\n| ---------------| --------------|--------------------| -------------------| -----------------------------------|\n| standard       | Yes           | Everytime an intent is created, a new instance is created. Also instances can be member of multiple tasks and more than one instance in a Task. | No. Open in the same Task that originated the intent | Yes    |\n| singleTop      | No            | Exactly like standard but if the activity is at the top of the Task stack then it uses the existing instance.       | No. Open in the same Task that originated the intent      |    Yes      |\n| singleTask     | No   | Single instance   |   Yes. Always a Root Task.      |       Yes          |\n| singleInstance | No    | Single instance     |    Yes. Always a Root Task.   |    Never. Always the only activity in the task  |\n\n[Source](https://guides.codepath.com/android/Navigation-and-Task-Stacks)\n\n## User interface\n### RecyclerView pieces\n\n| Piece           | What it does                                                                                                                                                                                                                                                                               |\n|-----------------|------------------------------------------------------------------------------------------------------------------------------|\n| `RecyclerView`  | The `ViewGroup` that contains the views corresponding to your data.                                                                                                                                                                                                                        |\n| item            | One data item of the list to display. Can be of any type; often a data class you define.                                                                                                                                                                                                   |\n| `Adapter`       | Takes data and prepares it for `RecyclerView` to display.                                                                                                                                                                                                                                  |\n| `ViewHolder`s   | A pool of views for `RecyclerView` to use and reuse to display items. Each individual `ViewHolder` is a wrapper around a `View`.                                                                                                                                                           |\n| `View`          | A layout that can display one data item.                                                                                                                                                                                                                                                   |\n| `LayoutManager` | Measures and positions individual item views within a `RecyclerView` and determines the policy for when to recycle item views that are no longer visible. The ones provided in the `RecyclerView` library are `LinearLayoutManager`, `GridLayoutManager`, and `StaggeredGridLayoutManager` |\n\n[Source](https://developer.android.com/codelabs/basic-android-kotlin-training-recyclerview-scrollable-list)\n\n### ImageView ScaleTypes\n\u003cimg src=\"https://raw.githubusercontent.com/frostyshadows/android-cheatsheet/master/ImageView-ScaleTypes.png\" width=\"60%\"\u003e\n\n[Source](https://thoughtbot.com/blog/android-imageview-scaletype-a-visual-guide)\n\n### [PorterDuff modes](https://developer.android.com/reference/android/graphics/PorterDuff.Mode) for tinting\n\n\u003cimg src=\"https://chiuki.github.io/images/android-shaders-filters/porter_duff.png\"\u003e\n\n[Source](https://chiuki.github.io/android-shaders-filters/#/)\n\n## Kotlin\n\n### Kotlin Standard Library functions\n\u003cimg src=\"https://github.com/frostyshadows/android-cheatsheet/blob/master/Kotlin-library-functions.png\" width=\"60%\"\u003e\n\n### Type system\n\u003cimg src=\"https://raw.githubusercontent.com/frostyshadows/android-cheatsheet/master/kotlin-nothing-entire-hierarchy.png\"\u003e\n\n[Source](http://natpryce.com/articles/000818.html)\n\n### Kotlin Flow Cheatsheet\n\u003cimg src=\"https://miro.medium.com/v2/resize:fit:1400/format:webp/1*z4Y5uZ_CU1g3gr1ubA5OVg.png\"\u003e\n\n[Source](https://medium.com/@galou.minisini/advanced-kotlin-flow-cheat-sheet-for-android-engineer-cb8157d4f848)\n\n## Jetpack Compose\n\n### Three phases of a frame\n\n\u003cimg src=\"https://developer.android.com/static/develop/ui/compose/images/compose-phases.png\" width=\"80%\"\u003e\n\n[Source](https://developer.android.com/jetpack/compose/phases)\n\n### Centering items in Composables\n\n\u003cimg src=\"https://github.com/frostyshadows/android-cheatsheet/blob/master/center-rows.png\"\u003e\n\n\u003cimg src=\"https://github.com/frostyshadows/android-cheatsheet/blob/master/center-columns.png\"\u003e\n\n\u003cimg src=\"https://github.com/frostyshadows/android-cheatsheet/blob/master/center-boxes.png\"\u003e\n\n### Choosing an API to implement an animation\n\n\u003cimg src=\"https://developer.android.com/static/develop/ui/compose/images/animations/compose_animation_decision_tree_v2.jpg\"\u003e\n\n[Source](https://developer.android.com/develop/ui/compose/animation/choose-api)\n\n## Architecture\n\n### Uncle Bob's clean architecture\n\n\u003cimg src=\"https://miro.medium.com/max/1200/0*JD606Sqx6RYZLKdu.\" width=\"60%\"\u003e\n\n[Source](https://android.jlelse.eu/thoughts-on-clean-architecture-b8449d9d02df)\n\n## Build process\n\u003cimg src=\"https://stuff.mit.edu/afs/sipb/project/android/docs/images/build.png\"\u003e\n\n[Source](https://stuff.mit.edu/afs/sipb/project/android/docs/tools/building/index.html)\n\n## General software engineering\n\n### Code review checklist\n\u003cimg src=\"https://i0.wp.com/www.michaelagreiler.com/wp-content/uploads/2019/08/Code_Review_Checklist_Greiler.png?w=800\u0026ssl=1\"\u003e\n\n[Source](https://www.michaelagreiler.com/code-review-checklist-2/)\n\n\u003cimg src=\"https://github.com/frostyshadows/android-cheatsheet/blob/master/Android-code-review-checklist.png\"\u003e\n\n### Gang of Four design patterns\n\u003cimg src=\"https://github.com/frostyshadows/android-cheatsheet/blob/master/GangOfFour-1.png\" width=\"100%\"\u003e\n\u003cimg src=\"https://github.com/frostyshadows/android-cheatsheet/blob/master/GangOfFour-2.png\" width=\"100%\"\u003e\n\n[Source](http://www.blackwasp.co.uk/GangOfFour.aspx)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrostyshadows%2Fandroid-cheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrostyshadows%2Fandroid-cheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrostyshadows%2Fandroid-cheatsheet/lists"}