Open in app

Sign In

Write

Sign In

Peter Törnhult
Peter Törnhult

145 Followers

Home

About

Published in ProAndroidDev

·2 days ago

Improving the Compose DropdownMenu

When migrating to Compose you may have come upon the DropdownMenu or the ExposedDropdownMenuBox + ExposedDropdownMenu. These APIs provide an easy interface for showing a list of items in a dropdown menu to let users pick a choice of items. However, if you have more than just a few items…

Jetpack Compose

6 min read

Improving the Compose DropdownMenu
Improving the Compose DropdownMenu
Jetpack Compose

6 min read


Published in ProAndroidDev

·Jan 23

Animated Selector in Jetpack Compose

Are you migrating to Compose but can’t get your AnimatedStateListDrawables to work? Here’s a solution that worked pretty well for me 👍 Some background… While trying to migrate BottomNavigationView to the Compose NavigationBar (Material3) I got stuck on errors when loading my icons in Compose. In my app, I’ve created AnimatedVectorDrawables using…

Jetpack Compose

4 min read

Animated Selector in Jetpack Compose
Animated Selector in Jetpack Compose
Jetpack Compose

4 min read


Published in ProAndroidDev

·Nov 17, 2021

Kotlin Inline Classes in an Android World

The Kotlin Inline (Value) class is a relatively new feature of the Kotlin language as it recently got a stable release in Kotlin 1.5. I first heard about Inline classes way back when I was on Kotlin 1.3 and the promises it made about being a better type-safe alternative to…

7 min read

Kotlin Inline Classes in an Android World
Kotlin Inline Classes in an Android World

7 min read


Published in ProAndroidDev

·Jun 3, 2020

LiveData transformations

LiveData is a great tool to use when working with Android Architecture Components. Before I knew how to use the Transformations class, I was abusing LiveData and creating a lot of code-smell. …

Livedata

4 min read

LiveData transformations
LiveData transformations
Livedata

4 min read


Published in ProAndroidDev

·Aug 21, 2019

How to unit test Room: runInTransaction

In case you have tried writing Unit tests for your application business logic but gotten stuck at testing your Room logic where some database calls are wrapped in a runInTransaction call, I just figured out how to stub it using MockK and thought I’d share it. Background This summer I thought…

Testing

3 min read

How to unit test Room: runInTransaction
How to unit test Room: runInTransaction
Testing

3 min read


Published in ProAndroidDev

·Mar 31, 2019

Testing Custom Views with Robolectric 4

This is a short tutorial/intro on how to set up and use Robolectric to create Component tests for your custom views. If you‘re not familiar with Robolectric, it’s a library which, instead of using an Emulator/Device, allows you to Unit test your Android application. …

Android

3 min read

Testing Custom Views with Robolectric 4
Testing Custom Views with Robolectric 4
Android

3 min read


Sep 10, 2018

Beware of Kotlin Runtime bugs

Converting Java to Kotlin Runtime bugs are scary! When you blindly convert Java to Kotlin you may have introduced them without knowing. I did when I converted my first project. Then I did it a second time, had I learned nothing? I recently read the article Curious case with Fragment’s onCreateAnimation() which got me…

Android App Development

4 min read

Beware of Kotlin Runtime bugs
Beware of Kotlin Runtime bugs
Android App Development

4 min read


Aug 29, 2017

Lifecycle & Fragments backstack

LiveData and ViewModel are two awesome new additions to the Android toolbox. The examples are straight forward, but unfortunately they don’t cover every aspect of the Android universe. Working with the FragmentManager backstack I encountered a problem. Here is how I solved it. Update 2020 At the time of writing this article…

Android

6 min read

Lifecycle & Fragments backstack
Lifecycle & Fragments backstack
Android

6 min read

Peter Törnhult

Peter Törnhult

145 Followers

Just do it

Following
  • Chet Haase

    Chet Haase

  • Niclas Gustafsson

    Niclas Gustafsson

  • Ambivrt

    Ambivrt

  • Florina Muntenescu

    Florina Muntenescu

  • Roman Elizarov

    Roman Elizarov

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech