# Android Blog - Mobile Dev Notes

Android development tutorials covering architecture, design patterns and and best practices in Android.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## StateFlow and SharedFlow in ViewModels

DevFeed: [StateFlow and SharedFlow in ViewModels](<https://devfeed.tech/articles/stateflow-and-sharedflow-in-viewmodels-22664.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/stateflow-sharedflow-flow-viewmodel-lifecycle>)

Author: James Shvarts

Published: 2022-12-28T19:21:19Z

Content type: article

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [state-management](<https://devfeed.tech/topics/state-management.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [collector](<https://devfeed.tech/tags/collector.md>), [flow](<https://devfeed.tech/tags/flow.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [lifecycle](<https://devfeed.tech/tags/lifecycle.md>), [sharedflow](<https://devfeed.tech/tags/sharedflow.md>), [state](<https://devfeed.tech/tags/state.md>), [stateflow](<https://devfeed.tech/tags/stateflow.md>), [testing](<https://devfeed.tech/tags/testing.md>), [unit-testing](<https://devfeed.tech/tags/unit-testing.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>), [vs](<https://devfeed.tech/tags/vs.md>)

### AI overview

StateFlow is presented as the more efficient, simpler choice for ViewModel state when a logical initial value exists: it holds and replays the latest value to new collectors, including across configuration changes, and supports non-suspending reads and writes. SharedFlow is configurable and suits repeated events such as snackbars or navigation because it can emit equal values again. With its default replay of 0, new collectors do not receive earlier emissions, so a collector that starts late may miss an event pushed by the ViewModel. The excerpt says the article also provides lifecycle-aware collection and ViewModel testing examples, but those details are not included here.

### Source excerpt

Collecting State and Shared Flows from ViewModels while respecting lifecycle of the collector views

## Testing functions with lambdas using MockK

DevFeed: [Testing functions with lambdas using MockK](<https://devfeed.tech/articles/testing-functions-with-lambdas-using-mockk-22666.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/testing-listener-lambda-mockk>)

Author: James Shvarts

Published: 2022-12-18T15:58:29Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Mocking](<https://devfeed.tech/topics/mocking.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [callback](<https://devfeed.tech/tags/callback.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [mocking](<https://devfeed.tech/tags/mocking.md>), [testing](<https://devfeed.tech/tags/testing.md>), [unit-test](<https://devfeed.tech/tags/unit-test.md>)

### AI overview

The excerpt shows how to test Kotlin functions that accept lambda callbacks with MockK: inject mocks into the test subject, capture each callback argument, and have the engine mock invoke the success or failure callback. Then verify that the instrument panel mock reports the corresponding outcome: ready to drive after a successful start, or a check engine light after failure. The excerpt assumes a mocking-based unit test and does not compare testing strategies.

### Source excerpt

Testing Kotlin lambda invocations with MockK

## Compose by example: BoxWithConstraints

DevFeed: [Compose by example: BoxWithConstraints](<https://devfeed.tech/articles/compose-by-example-boxwithconstraints-22650.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/compose-boxwithconstraints-boxwithconstraintsscope>)

Author: james shvarts

Published: 2022-11-18T12:30:48Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [mobile-ui-design](<https://devfeed.tech/topics/mobile-ui-design.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>)

Tags: [adaptive](<https://devfeed.tech/tags/adaptive.md>), [compose](<https://devfeed.tech/tags/compose.md>), [example](<https://devfeed.tech/tags/example.md>), [layouts](<https://devfeed.tech/tags/layouts.md>), [responsive](<https://devfeed.tech/tags/responsive.md>)

### AI overview

The excerpt shows how BoxWithConstraints can support an adaptive Jetpack Compose carousel: use the available constraints to detect portrait or landscape orientation and size cards so two or four are fully visible, respectively, with another card peeking. It says BoxWithConstraints is similar to Box but exposes parent dimensions and constraints for choosing what to display or how to lay it out. The tradeoff is that Composition is deferred until Layout has the constraints and dimensions, adding work during Layout that may be noticeable in complex layouts. The excerpt omits code details.

### Source excerpt

A practical example of using BoxWithConstraints in Jetpack Compose to build responsive layouts

## Slim down your Android components with LifecycleObserver

DevFeed: [Slim down your Android components with LifecycleObserver](<https://devfeed.tech/articles/slim-down-your-android-components-with-lifecycleobserver-22657.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/default-lifecycle-observer>)

Author: james shvarts

Published: 2022-11-17T21:11:40Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [Dagger](<https://devfeed.tech/topics/dagger.md>), [software-development](<https://devfeed.tech/topics/software-development.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [custom](<https://devfeed.tech/tags/custom.md>), [dagger](<https://devfeed.tech/tags/dagger.md>), [dagger-hilt](<https://devfeed.tech/tags/dagger-hilt.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [lifecycle](<https://devfeed.tech/tags/lifecycle.md>)

### AI overview

A custom LifecycleObserver can move lifecycle callbacks out of oversized Android components. Implement the observer interface and override only the callbacks you need, then register it with an Activity or Fragment lifecycle; observe a Fragment's view lifecycle through its viewLifecycleOwner, which is unavailable in onCreate. Observers need not be explicitly removed, and multiple observers can organize or share lifecycle work. The excerpt also describes observing the Application/process lifecycle and says the observer can be injected with Dagger or Hilt, but its scoping discussion is truncated, so it does not establish how to configure or reuse scoped instances.

### Source excerpt

Learn to create custom LifecycleObserver components and inject them with Dagger/Hilt

## Show BottomBar conditionally in Compose

DevFeed: [Show BottomBar conditionally in Compose](<https://devfeed.tech/articles/show-bottombar-conditionally-in-compose-22663.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/should-show-bottombar-conditionally-in-jetpack-compose>)

Author: James Shvarts

Published: 2022-11-08T21:38:12Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [bottom-navigation](<https://devfeed.tech/topics/bottom-navigation.md>), [jetpack-navigation](<https://devfeed.tech/topics/jetpack-navigation.md>)

Tags: [bottom-navigation](<https://devfeed.tech/tags/bottom-navigation.md>), [compose](<https://devfeed.tech/tags/compose.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [navigation](<https://devfeed.tech/tags/navigation.md>), [route](<https://devfeed.tech/tags/route.md>)

### AI overview

The Jetpack Compose example hides the bottom bar on selected routes by checking the current route against an enum, with a custom AppState handling navigation and visibility. It uses a separate navigation graph for each tab and demonstrates navigating from a Home list to an item detail screen, whose route omits the bar. The sample leaves out Google's animated bottom bar and focuses on the navigation and conditional display setup. The excerpt mentions message handling and a failure-triggered case, but omits the implementation details.

### Source excerpt

Conditionally show BottomBar with bottom navigation in Jetpack Compose

## Compose by example: Intrinsics

DevFeed: [Compose by example: Intrinsics](<https://devfeed.tech/articles/compose-by-example-intrinsics-22658.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/intrinsics-intrinsicsize-height-max>)

Author: James Shvarts

Published: 2022-11-05T22:25:24Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>)

Tags: [compose](<https://devfeed.tech/tags/compose.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [layout](<https://devfeed.tech/tags/layout.md>), [measurements](<https://devfeed.tech/tags/measurements.md>)

### AI overview

A Jetpack Compose example showing how intrinsic measurements and IntrinsicSize can make a middle column match the height of the tallest column in a row.

### Source excerpt

Example of using IntrinsicSize in Jetpack Compose

## Basic Auth with OkHttp and Retrofit

DevFeed: [Basic Auth with OkHttp and Retrofit](<https://devfeed.tech/articles/basic-auth-with-okhttp-and-retrofit-22649.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/basic-auth-okhttp-retrofit-dagger>)

Author: James Shvarts

Published: 2022-11-05T22:25:12Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [client library](<https://devfeed.tech/topics/client-library.md>), [Dagger](<https://devfeed.tech/topics/dagger.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [annotations](<https://devfeed.tech/tags/annotations.md>), [api](<https://devfeed.tech/tags/api.md>), [auth](<https://devfeed.tech/tags/auth.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [basic](<https://devfeed.tech/tags/basic.md>), [configure](<https://devfeed.tech/tags/configure.md>), [custom](<https://devfeed.tech/tags/custom.md>), [dagger](<https://devfeed.tech/tags/dagger.md>), [dagger-hilt](<https://devfeed.tech/tags/dagger-hilt.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [header](<https://devfeed.tech/tags/header.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [http](<https://devfeed.tech/tags/http.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-android](<https://devfeed.tech/tags/kotlin-android.md>), [okhttp](<https://devfeed.tech/tags/okhttp.md>), [project](<https://devfeed.tech/tags/project.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>)

### AI overview

The post outlines a Kotlin Android example that uses OkHttp and Retrofit for an HTTP GET request to an endpoint requiring Basic Authentication. It describes routing outgoing requests through a custom component that sets the authentication header, then wiring the repository interface and implementation through Dagger/Hilt for use in a ViewModel. Moshi is listed for JSON handling, with its annotations tied to the API contract. The excerpt does not include the code or specify the exact header construction.

### Source excerpt

Basic Auth example using OkHttp, Retrofit, Dagger in a Kotlin project

## Animation in Jetpack Compose

DevFeed: [Animation in Jetpack Compose](<https://devfeed.tech/articles/animation-in-jetpack-compose-22648.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/animation-compose-api-summary>)

Author: James Shvarts

Published: 2022-07-01T04:00:00Z

Content type: article

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [animations](<https://devfeed.tech/topics/animations.md>)

Tags: [animation](<https://devfeed.tech/tags/animation.md>), [apis](<https://devfeed.tech/tags/apis.md>), [compose](<https://devfeed.tech/tags/compose.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [overview](<https://devfeed.tech/tags/overview.md>)

### AI overview

The excerpt presents Jetpack Compose animation APIs as a choice based on what is being animated and how much control is needed. It points to AnimatedVisibility for content entering or leaving composition and Crossfade for switching between layouts, and says state-based animations can carry ongoing values into a new animation when interrupted. It also distinguishes infinite animations, simultaneous changes to multiple values, and cases needing fine control over timing, but the relevant API names are missing from the excerpt. The APIs are described as declarative, customizable, and often built as composable functions over coroutine-based lower-level APIs; Android Studio provides animation tooling. This is a partial overview, not a complete decision guide.

### Source excerpt

Foundational overview of Compose Animation APIs to help you choose most suitable API for your animation task.

## Compose sample app: UI state with Flow, offline first

DevFeed: [Compose sample app: UI state with Flow, offline first](<https://devfeed.tech/articles/compose-sample-app-ui-state-with-flow-offline-first-22656.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/compose-ui-state-flow-offline-first-repository>)

Author: James Shvarts

Published: 2022-06-25T04:20:32Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [Android](<https://devfeed.tech/topics/android.md>), [Persistence](<https://devfeed.tech/topics/persistence.md>), [Database](<https://devfeed.tech/topics/database.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [compose](<https://devfeed.tech/tags/compose.md>), [database](<https://devfeed.tech/tags/database.md>), [flow](<https://devfeed.tech/tags/flow.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [offline](<https://devfeed.tech/tags/offline.md>), [persistence](<https://devfeed.tech/tags/persistence.md>), [state](<https://devfeed.tech/tags/state.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

This tutorial presents an Android sample app built with Jetpack Compose and Kotlin Flow. It explains UI state modeling, an offline-first reactive repository backed by a Room database, unit testing with Turbine, and composition optimization lessons.

### Source excerpt

Sample repo implementing state using Flow, Offline First repository, unit tests using Turbine.

## Test Coroutine Scheduler

DevFeed: [Test Coroutine Scheduler](<https://devfeed.tech/articles/test-coroutine-scheduler-22665.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/test-coroutine-scheduler-dispatcher-main-rule>)

Author: James Shvarts

Published: 2022-06-24T00:55:12Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [coroutine-testing](<https://devfeed.tech/topics/coroutine-testing.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>)

Tags: [coroutine](<https://devfeed.tech/tags/coroutine.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [scheduler](<https://devfeed.tech/tags/scheduler.md>), [test](<https://devfeed.tech/tags/test.md>)

### AI overview

For JVM unit tests that launch coroutines through a scope bound to Main, the excerpt says to add the latest `kotlinx-coroutines-test` dependency and install a test dispatcher as Main. It recommends `UnconfinedTestDispatcher` for Main because its eager behavior matches production more closely. `StandardTestDispatcher` queues coroutines for manual advancement and is created by default with `runTest`; `UnconfinedTestDispatcher` starts coroutines eagerly and is suggested selectively for migrating older tests, Main, or collecting values. The excerpt cautions against deprecated `TestCoroutineDispatcher`.

### Source excerpt

Using TestCoroutineScheduler, a scheduler for coroutines used in tests, that provides the delay-skipping behavior.

## Animating visibility vs alpha in Compose

DevFeed: [Animating visibility vs alpha in Compose](<https://devfeed.tech/articles/animating-visibility-vs-alpha-in-compose-22647.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/animatedvisibility-animate-float-as-state-alpha-position>)

Author: james shvarts

Published: 2022-06-13T03:26:33Z

Content type: article

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>)

Tags: [alpha](<https://devfeed.tech/tags/alpha.md>), [animation](<https://devfeed.tech/tags/animation.md>), [compose](<https://devfeed.tech/tags/compose.md>), [layout](<https://devfeed.tech/tags/layout.md>), [visibility](<https://devfeed.tech/tags/visibility.md>)

### AI overview

In Compose, `AnimatedVisibility` removes the image from the composition when hidden, so a vertically centered button shifts as the layout changes. To keep the button in place, the excerpt recommends keeping the image in the composition and animating its alpha with `animateFloatAsState`; the image recomposes as the animated value changes, while the button retains its position.

### Source excerpt

Covers example when animateFloatAsState is what you need instead of AnimatedVisibility

## Practical Compose Slot API example

DevFeed: [Practical Compose Slot API example](<https://devfeed.tech/articles/practical-compose-slot-api-example-22655.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/compose-slot-api-example-composable-content-lambda>)

Author: James Shvarts

Published: 2022-05-31T12:54:19Z

Content type: article

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>)

Tags: [compose](<https://devfeed.tech/tags/compose.md>), [content](<https://devfeed.tech/tags/content.md>), [data-class](<https://devfeed.tech/tags/data-class.md>), [filter](<https://devfeed.tech/tags/filter.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [layout](<https://devfeed.tech/tags/layout.md>), [pattern](<https://devfeed.tech/tags/pattern.md>), [screen](<https://devfeed.tech/tags/screen.md>)

### AI overview

The excerpt models a screen as reusable sections with a Compose Slot API: each HomeSection has a required title and content lambda, plus an optional filter for a "See All" action. The caller supplies each section's composable content, so sections can share an overall layout while arranging their own data to fit their needs. The filter is represented as a data class to avoid inconsistent combinations of nullable filter data and action lambdas; when absent, no filter action is rendered. The excerpt notes that slots can support reuse and flexibility, but whether this pattern fits depends on the use case.

### Source excerpt

Learn how to manage screen sections using Slot API pattern in Compose

## Lazy Grid layouts in Compose

DevFeed: [Lazy Grid layouts in Compose](<https://devfeed.tech/articles/lazy-grid-layouts-in-compose-22660.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/lazy-grids-gridcells-fixed-adaptive-custom-compose>)

Author: James Shvarts

Published: 2022-05-26T02:39:38Z

Content type: article

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [mobile-ui-design](<https://devfeed.tech/topics/mobile-ui-design.md>)

Tags: [adaptive](<https://devfeed.tech/tags/adaptive.md>), [compose](<https://devfeed.tech/tags/compose.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [custom](<https://devfeed.tech/tags/custom.md>), [fixed](<https://devfeed.tech/tags/fixed.md>), [grid](<https://devfeed.tech/tags/grid.md>), [layouts](<https://devfeed.tech/tags/layouts.md>), [lazy](<https://devfeed.tech/tags/lazy.md>)

### AI overview

Jetpack Compose 1.2.0 made lazy grids stable. Fixed grids keep a specified number of columns or rows, dividing available screen width or height among them; rotation preserves the count, so cards may become wider. Adaptive vertical grids choose how many cells fit based on available space, spacing, and a specified minimum cell size, making them useful across screen sizes. For custom layouts, implement the GridCells interface; the excerpt gives examples of unequal column widths and items that span the full grid width, including every third item.

### Source excerpt

Covers 3 ways to build lazy grid layouts using fixed, adaptive and custom configuration

## Lazy layouts contentPadding

DevFeed: [Lazy layouts contentPadding](<https://devfeed.tech/articles/lazy-layouts-contentpadding-22661.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/lazy-layouts-lazyrow-lazycolumn-contentpadding-compose>)

Author: James Shvarts

Published: 2022-05-22T12:57:51Z

Content type: article

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [layout](<https://devfeed.tech/topics/layout.md>)

Tags: [clipping](<https://devfeed.tech/tags/clipping.md>), [compose](<https://devfeed.tech/tags/compose.md>), [layouts](<https://devfeed.tech/tags/layouts.md>), [lazy](<https://devfeed.tech/tags/lazy.md>), [padding](<https://devfeed.tech/tags/padding.md>), [recyclerview](<https://devfeed.tech/tags/recyclerview.md>)

### AI overview

For Compose lazy layouts, use the `contentPadding` parameter to add space before the first item and after the last without clipping items as they scroll. Applying padding directly to the layout keeps it around every item; clipping to those padded bounds also causes problems. The excerpt says the same fix applies to a similar layout, but omits the relevant code and some layout names.

### Source excerpt

Controlling padding for first and last item in a lazy layout in Compose

## Composable functions and return types

DevFeed: [Composable functions and return types](<https://devfeed.tech/articles/composable-functions-and-return-types-22652.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/compose-composable-return-types>)

Author: James Shvarts

Published: 2022-05-21T17:51:19Z

Content type: article

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [function](<https://devfeed.tech/topics/function.md>), [factory function](<https://devfeed.tech/topics/factory-function.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [Compose Compiler](<https://devfeed.tech/topics/compose-compiler.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [compose](<https://devfeed.tech/tags/compose.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [factory](<https://devfeed.tech/tags/factory.md>), [factory-function](<https://devfeed.tech/tags/factory-function.md>), [functions](<https://devfeed.tech/tags/functions.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [return](<https://devfeed.tech/tags/return.md>), [types](<https://devfeed.tech/tags/types.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

Composable functions that emit UI conventionally return Unit and use PascalCase names. They build a representation of UI state for the composition tree; because they may recompose, the excerpt says they should be idempotent and free of side effects. Composable factory functions instead return a value and do not emit UI; they are conventionally lower camel case and are usually called from UI-emitting composables. The excerpt notes that factories can use composition lifecycle and inputs such as remember, and gives a coroutine-scope example whose name indicates it is remembered before return. The text is incomplete, so further details and the full cancellation behavior are unavailable.

### Source excerpt

Exploring composable function characteristics and return types

## Compose phases and optimizations

DevFeed: [Compose phases and optimizations](<https://devfeed.tech/articles/compose-phases-and-optimizations-22653.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/compose-phases-optimizing-composition-layout-drawing>)

Author: James Shvarts

Published: 2022-05-14T01:27:04Z

Content type: article

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>)

Tags: [canvas](<https://devfeed.tech/tags/canvas.md>), [compose](<https://devfeed.tech/tags/compose.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [optimizations](<https://devfeed.tech/tags/optimizations.md>), [optimizing](<https://devfeed.tech/tags/optimizing.md>), [performance](<https://devfeed.tech/tags/performance.md>)

### AI overview

Jetpack Compose renders each frame through Composition, Layout, and Drawing, and changes can cause more phases to run than necessary. In the described animated square, reading color in composable content triggers recomposition on every frame. The post moves the color read into a lambda-based drawing modifier that draws on Canvas. Because the lambda is a stable function instance that reads the changing color, only Drawing needs to repeat; Composition and Layout occur once. The visible UI stays the same while the example reduces repeated phase work.

### Source excerpt

Learn about Compose Phases and optimizing UI by controlling what Phases get executed when data in composable changes

## Using MotionLayout in Compose

DevFeed: [Using MotionLayout in Compose](<https://devfeed.tech/articles/using-motionlayout-in-compose-22662.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/motionlayout-in-compose-motion-scene-json5>)

Author: James Shvarts

Published: 2022-05-05T11:52:55Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Android](<https://devfeed.tech/topics/android.md>), [constraintlayout](<https://devfeed.tech/topics/constraintlayout.md>)

Tags: [android-development](<https://devfeed.tech/tags/android-development.md>), [animation](<https://devfeed.tech/tags/animation.md>), [compose](<https://devfeed.tech/tags/compose.md>), [experimental](<https://devfeed.tech/tags/experimental.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [json](<https://devfeed.tech/tags/json.md>), [motionlayout](<https://devfeed.tech/tags/motionlayout.md>)

### AI overview

The excerpt shows how to animate Compose widgets with MotionLayout using a JSON5 motion scene. It describes opting into the experimental API, connecting a named divider in the scene to a composable, and driving animation progress with a slider. Constraints in the scene position both the divider and an added Jetpack Compose logo; the example moves the logo relative to the divider and describes an arc path. The author favors JSON5 constraint sets over defining them in code, citing clearer separation and easier editing, while noting the Compose API was experimental and limited at the time. The excerpt ends mid-example, so it does not establish the full implementation.

### Source excerpt

A demo of using MotionLayout with Jetpack Compose with motion scene set up as a JSON5

## Making reusable composables using Generics

DevFeed: [Making reusable composables using Generics](<https://devfeed.tech/articles/making-reusable-composables-using-generics-22651.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/compose-composable-function-generics>)

Author: James Shvarts

Published: 2022-04-29T20:02:08Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [generic programming](<https://devfeed.tech/topics/generic-programming.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Java](<https://devfeed.tech/topics/java.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [component](<https://devfeed.tech/tags/component.md>), [compose](<https://devfeed.tech/tags/compose.md>), [dialog](<https://devfeed.tech/tags/dialog.md>), [generics](<https://devfeed.tech/tags/generics.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

### AI overview

This tutorial shows how to use Java Generics with Jetpack Compose to build reusable composable components that support different model objects. It demonstrates a shared delete-confirmation dialog, call sites, optional properties, and state handling in a ViewModel.

### Source excerpt

Using Java Generics to create reusable shared components in Compose

## Getting started with Canvas in Compose

DevFeed: [Getting started with Canvas in Compose](<https://devfeed.tech/articles/getting-started-with-canvas-in-compose-22659.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/jetpack-compose-canvas-custom-component-ondraw-drawscope>)

Author: James Shvarts

Published: 2022-04-04T21:24:55Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>)

Tags: [canvas](<https://devfeed.tech/tags/canvas.md>), [component](<https://devfeed.tech/tags/component.md>), [compose](<https://devfeed.tech/tags/compose.md>), [custom](<https://devfeed.tech/tags/custom.md>), [drawing](<https://devfeed.tech/tags/drawing.md>)

### AI overview

The excerpt shows how to start drawing in Jetpack Compose with Canvas: its size is zero by default, so apply a size-related modifier before drawing to make the canvas visible. It then wraps the drawing in a reusable composable whose parent controls positioning. As an alternative, draw behind an existing composable with a drawing modifier when you need to add a background to a complex or already-built UI; use Canvas directly for other cases. The excerpt notes that Compose manages drawing state and performance, and that a drawing modifier can provide the behind-content effect without the view-based Canvas API.

### Source excerpt

Explore DrawScope and create your first custom component using Canvas in Jetpack Compose

## Compose Row, Column and Scoped Modifiers

DevFeed: [Compose Row, Column and Scoped Modifiers](<https://devfeed.tech/articles/compose-row-column-and-scoped-modifiers-22654.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/compose-row-column-rowscope-columnscope-modifier>)

Author: James Shvarts

Published: 2022-03-29T02:48:35Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [alignment](<https://devfeed.tech/tags/alignment.md>), [code](<https://devfeed.tech/tags/code.md>), [compose](<https://devfeed.tech/tags/compose.md>), [function](<https://devfeed.tech/tags/function.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [layout](<https://devfeed.tech/tags/layout.md>), [receiver](<https://devfeed.tech/tags/receiver.md>), [space](<https://devfeed.tech/tags/space.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

This tutorial explains how to build layouts in Jetpack Compose with Row and Column composables. It covers horizontal and vertical arrangement, alignment, scoped modifiers through RowScope and ColumnScope, modifier chaining, and scoping composables.

### Source excerpt

Explore the power of Row and Column composables and their respective RowScope and ColumnScope modifiers to layout child composables