# parcelable

Published articles for parcelable.

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

## Пишем плагин Parcelize для компилятора Kotlin под iOS

DevFeed: [Пишем плагин Parcelize для компилятора Kotlin под iOS](<https://devfeed.tech/articles/parcelize-kotlin-ios-23642.md>)

Original publisher: [Read original article](<https://habr.com/ru/companies/badoo/articles/566380/>)

Author: arkivanov (Badoo)

Published: 2021-07-09T07:30:01Z

Content type: tutorial

Language: ru

Sources: [Badoo EN](<https://devfeed.tech/sources/badoo-en.md>), [Badoo RU](<https://devfeed.tech/sources/badoo-ru.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [ios](<https://devfeed.tech/tags/ios.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [native](<https://devfeed.tech/tags/native.md>), [parcelable](<https://devfeed.tech/tags/parcelable.md>), [parcelize](<https://devfeed.tech/tags/parcelize.md>), [tag-25559b1b0132](<https://devfeed.tech/tags/tag-25559b1b0132.md>), [tag-9e9e5e80d07a](<https://devfeed.tech/tags/tag-9e9e5e80d07a.md>), [tag-a071763eb5bb](<https://devfeed.tech/tags/tag-a071763eb5bb.md>), [tag-e076f05a03bb](<https://devfeed.tech/tags/tag-e076f05a03bb.md>)

### AI overview

The article describes the author's experience creating kotlin-parcelize-darwin, a Kotlin compiler plugin for iOS using Kotlin/Native. It explains the Android kotlin-parcelize and Parcelable model as background, then discusses preserving iOS application state with NSCoding and the motivation for an analogous solution.

### Source excerpt

В этой статье описан мой опыт по написанию плагина для компилятора Kotlin. Моей главной целью было создание плагина под iOS (Kotlin/Native), аналогичного kotlin-parcelize под Android. Дело в том, что в iOS, как и в Android, приложения тоже могут быть убиты системой, а значит, может возникнуть необходимость сохранять стек навигации и другие данные. В результате работы над этой задачей получился kotlin-parcelize-darwin. Подробности о его создании и применении -- под катом. Читать далее

## Decoding Handler and Looper in Android

DevFeed: [Decoding Handler and Looper in Android](<https://devfeed.tech/articles/decoding-handler-and-looper-in-android-38621.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2019_12_24_decoding_handler_and_looper_in_android/>)

Published: 2019-12-24T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [class](<https://devfeed.tech/topics/class.md>), [callback](<https://devfeed.tech/topics/callback.md>), [interface](<https://devfeed.tech/topics/interface.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [abstraction](<https://devfeed.tech/tags/abstraction.md>), [android](<https://devfeed.tech/tags/android.md>), [callback](<https://devfeed.tech/tags/callback.md>), [class](<https://devfeed.tech/tags/class.md>), [code](<https://devfeed.tech/tags/code.md>), [interface](<https://devfeed.tech/tags/interface.md>), [object](<https://devfeed.tech/tags/object.md>), [parcelable](<https://devfeed.tech/tags/parcelable.md>), [payload](<https://devfeed.tech/tags/payload.md>), [thread](<https://devfeed.tech/tags/thread.md>)

### AI overview

This tutorial explains Android's Handler and Looper, describing Looper as an event-loop abstraction that drains a MessageQueue and Handler as an abstraction for posting, removing, and handling queued events. It also covers their relationships and the structure of Message objects.

### Source excerpt

Introduction Handler and Looper are one of the main low-level Android OS things, which almost nobody uses directly (at least nowadays). But they are at the core, so many other high-level solutions are based on them. Therefore one should know what Handler and Looper are, what and how they are doing. In this article we'll try to understand Handler and Looper in Android. What, how and why we might need them. We'll start from some basic knowledge on classes and what they are doing, continue with relations between them. Then we'll look at each class separately trying to dive deep into details. And will finish with some canonical examples on where they can be used.

## A study of the Parcelize feature from Kotlin Android Extensions

DevFeed: [A study of the Parcelize feature from Kotlin Android Extensions](<https://devfeed.tech/articles/a-study-of-the-parcelize-feature-from-kotlin-android-extensions-25876.md>)

Original publisher: [Read original article](<https://bladecoder.medium.com/a-study-of-the-parcelize-feature-from-kotlin-android-extensions-59a5adcd5909?source=rss-54910f05af37------2>)

Author: Christophe Beyls

Published: 2019-11-19T07:31:01Z

Content type: tutorial

Language: en

Sources: [Stories by Christophe Beyls on Medium](<https://devfeed.tech/sources/stories-by-christophe-beyls-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Android](<https://devfeed.tech/topics/android.md>), [Code generation](<https://devfeed.tech/topics/code-generation.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>), [jetbrains](<https://devfeed.tech/topics/jetbrains.md>), [Google](<https://devfeed.tech/topics/google.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [code-generation](<https://devfeed.tech/tags/code-generation.md>), [google](<https://devfeed.tech/tags/google.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [gradle-plugin](<https://devfeed.tech/tags/gradle-plugin.md>), [jetbrains](<https://devfeed.tech/tags/jetbrains.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-android](<https://devfeed.tech/tags/kotlin-android.md>), [kotlin-android-extensions](<https://devfeed.tech/tags/kotlin-android-extensions.md>), [parcelable](<https://devfeed.tech/tags/parcelable.md>), [parcelize](<https://devfeed.tech/tags/parcelize.md>), [plugin](<https://devfeed.tech/tags/plugin.md>), [production](<https://devfeed.tech/tags/production.md>)

### AI overview

This article examines Kotlin's Parcelize feature, formerly part of Kotlin Android Extensions, as a production-ready way to generate Android Parcelable implementations. It discusses the feature's generated-code efficiency, plugin support, handling of unsupported types, and lack of runtime library overhead, then introduces the required Kotlin and Android Studio setup.

### Source excerpt

Life is too short to waste time on writing Parcelable code Two years ago, I wrote about how you can leverage features of the Kotlin programming language to manually write your Android Parcelable implementations in the most concise and readable way. Does it mean that I always prefer writing this code manually rather than letting a library or tool generate it for me? Of course not: like most developers, I believe that the best code is the code you don't have to write. But I expect the tools I use to meet my quality standards. That's why I tend to be conservative about the dependencies I add to my projects and will always favor official libraries from Jetbrains or Google over third-party solutions. Things have changed for the better since I wrote the previous article: with the release of Kotlin 1.3.40, @Parcelize is now a stable feature provided by the Parcelize Gradle plugin (formerly known as Kotlin Android Extensions). And since version 1.3.60, the Android Studio plugin also properly recognizes the feature as non-experimental so it can finally be considered as production-ready. I previously enumerated a list of some of the negative aspects of third-party Parcelable code generation libraries compared to manual implementation. Here's why I believe @Parcelize stands out from the rest in regard to that list: It's an official plugin made by JetBrains with the collaboration of Google and is guaranteed to be well supported in the future The generated code of @Parcelize is very efficient (as we'll discover further in this article) The CREATOR field doesn't have to be declared at all, along with that easy-to-forget @JvmField annotation Thanks to the Parceler interface, it is possible to write simple plugins to handle unsupported types or override the default implementation No extra classes are created by the plugin. All the generated code is embedded in the annotated class so the app will behave exactly as if you wrote the code yourself There is no runtime library overhead a

## Note to Future Me -- Testing Intents with Matchers

DevFeed: [Note to Future Me -- Testing Intents with Matchers](<https://devfeed.tech/articles/note-to-future-me-testing-intents-with-matchers-32073.md>)

Original publisher: [Read original article](<https://www.maiatoday.net/p/note-to-future-me-testing-intents-with-matchers/>)

Published: 2018-01-26T14:54:45Z

Content type: tutorial

Language: en

Sources: [maiatoday](<https://devfeed.tech/sources/maiatoday.md>)

Topics: [Testing](<https://devfeed.tech/topics/testing.md>), [test](<https://devfeed.tech/topics/test.md>), [parcelable](<https://devfeed.tech/topics/parcelable.md>), [Code](<https://devfeed.tech/topics/code.md>), [Library](<https://devfeed.tech/topics/library.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [data](<https://devfeed.tech/tags/data.md>), [data-class](<https://devfeed.tech/tags/data-class.md>), [error-messages](<https://devfeed.tech/tags/error-messages.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [library](<https://devfeed.tech/tags/library.md>), [parcelable](<https://devfeed.tech/tags/parcelable.md>), [testing](<https://devfeed.tech/tags/testing.md>), [testing-matchers](<https://devfeed.tech/tags/testing-matchers.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

This tutorial demonstrates testing Android activity intents with Espresso and Hamcrest matchers in Kotlin. It passes a parcelable data object between activities, verifies the intent extra and its properties, and shows how custom matchers can improve error messages and test only selected properties.

### Source excerpt

I want to make my little experiments public and save them as a reminder for future me. So here is yet another post on Matchers and Espresso testing. I want to test this: First activity starts another activity at a button click. First activity passes a parcelable object to the second activity. Test that the intent that starts the second activity contains the object with the correct properties. I built a contrived example, MainActivity collects some info and passes this to StarActivity in a parcelable called ContrivedParams. See the sample code on GitHub. To write the tests I brushed up on Hamcrest[1][2][3]: a library that makes it easier to write readable tests. Instead of assert(expected==actual) you can write almost-english assertThat(actual, is(expected)) which is a sugar coated version of assertThat(actual is(equalto(expected))) Sadly though is is a hard keyword in Kotlin so I ended up using the isA() and equalTo() varieties of calls rather than escaping is with backticks. Another reason to use Hamcrest -- better error messages. Compare these two messages. java.lang.AssertionError at net.maiatoday.hellointentmatcher.ContrivedParamsTest.showErroMessagesTest(ContrivedParamsTest.kt:37) with the message given by a custom matcher java.lang.AssertionError: Expected: title should return "Hello World" but: was "Hello World!" at net.maiatoday.hellointentmatcher.ContrivedParamsTest.showErroMessagesTest(ContrivedParamsTest.kt:42) or the error message given by an object matcher java.lang.AssertionError: Expected: <ContrivedParams(title=Hello World, starCount=3, colour=#00b0ff)> but: was <ContrivedParams(title=Hello World!, starCount=4, colour=#00b0fff)> at net.maiatoday.hellointentmatcher.ContrivedParamsTest.showErroMessagesTest(ContrivedParamsTest.kt:47) The parameters for the second activity is passed in a parcelable data class. I used the Espresso-intents library . Start the activity with an IntentsTestRule. The IntentsTestRule initialises the Espresso intents before each

## ParcelablePlease: Generating Android Parcelable Code with Annotation Processing

DevFeed: [ParcelablePlease: Generating Android Parcelable Code with Annotation Processing](<https://devfeed.tech/articles/parcelableplease-25462.md>)

Original publisher: [Read original article](<https://hannesdorfmann.com/android/parcelableplease/>)

Author: Hannes Dorfmann

Published: 2014-09-24T09:00:00Z

Content type: tutorial

Language: en

Sources: [Hannes Dorfmann](<https://devfeed.tech/sources/hannes-dorfmann.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Boilerplate](<https://devfeed.tech/topics/boilerplate.md>), [Code](<https://devfeed.tech/topics/code.md>), [Java](<https://devfeed.tech/topics/java.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [annotation-processor](<https://devfeed.tech/tags/annotation-processor.md>), [blog-post](<https://devfeed.tech/tags/blog-post.md>), [code](<https://devfeed.tech/tags/code.md>), [fragments](<https://devfeed.tech/tags/fragments.md>), [java](<https://devfeed.tech/tags/java.md>), [parcelable](<https://devfeed.tech/tags/parcelable.md>)

### AI overview

This tutorial introduces ParcelablePlease, an Android annotation processor intended to reduce boilerplate code when implementing Parcelable. It compares the approach with Parceler and AutoParcel, explaining their generated wrapper or subclass designs and compatibility trade-offs.

### Source excerpt

In my last blog post I have introduced FragmentArgs an Annotation Processor for Fragments that reduces writing boilerplate code. In this post I want to talk about a similar problem android developer face: Writing boilerplate code for Parcelable This post is part of a series of posts about useful annotation processors like FragmentArgs or AnnotatedAdapter