Giter Site home page Giter Site logo

android-cheatsheet's Introduction

Android Cheatsheet

This is a collection of visual guides that I find myself coming back to repeatedly while doing Android development. Open to contributions!

Table of contents

Activities and Fragments

User interface

Kotlin

Jetpack Compose

Architecture

Build process

General software engineering

Activities and Fragments

Lifecycle flowchart

Callback methods

Callback When What Is Activity visible
onCreate() Activity is first created All the necessary UI elements should be initialized no
onStart() Activity becomes visible to user Code that maintains the UI, start async tasks (get data from API or database), register listeners yes
onResume() Activity becomes interactable to user Starts animations yes
onPause() User is leaving the activity Stops animations partially visible
onStop() Activity is no longer visible to user Unregisters listeners and resources allocated in onStart() no
onRestart() Activity in the stopped state is about to start again (on back click) Cursor objects should be re-queried no
onDestroy() Activity is destroyed from memory no

Launch modes

Mode Default Instantiation New Task on Launch Allow other activities within Task
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
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
singleTask No Single instance Yes. Always a Root Task. Yes
singleInstance No Single instance Yes. Always a Root Task. Never. Always the only activity in the task

Source

User interface

RecyclerView pieces

Piece What it does
RecyclerView The ViewGroup that contains the views corresponding to your data.
item One data item of the list to display. Can be of any type; often a data class you define.
Adapter Takes data and prepares it for RecyclerView to display.
ViewHolders A pool of views for RecyclerView to use and reuse to display items. Each individual ViewHolder is a wrapper around a View.
View A layout that can display one data item.
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

Source

ImageView ScaleTypes

Source

PorterDuff modes for tinting

Source

Kotlin

Kotlin Standard Library functions

Type system

Source

Jetpack Compose

Choosing an API to implement an animation

Source

Architecture

Uncle Bob's clean architecture

Source

Build process

Source

General software engineering

Code review checklist

Source

Gang of Four design patterns

Source

android-cheatsheet's People

Contributors

frostyshadows avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.