LocalDate Parsing or How Being Strict Can Save Your Day

tl;dr: Careful with validation via LocalDate parsing The original bug We had a bug reported on our Android app this week about invalid dates coming into the backend during a particular UI flow. The problematic section was a page where users could enter the date of an event, then we call the backend API with the date they entered. The issue they were seeing is that the date we were sending wasn’t valid for some odd reason....

2022-07-07 · 4 min · Michael Fazio

Calculating Batting Stats - Filter, FlatMap, and GroupBy

Today’s a discussion of baseball, stats, box scores, and three handy Kotlin functions. tl;dr We cover three built-in Kotlin functions today: filter { ... }: Return a new Collection with all the items that cause the attached predicate block to return true. flatMap { ... }: Take a List of List objects and turn it into a single List with all the items together. groupBy { ... }: Turn a List into a Map with the value from the key selector block....

2021-10-23 · 5 min · Michael Fazio

'Kotlin and Android Development featuring Jetpack' Videos

I created a trio of videos as accompaniments to “Kotlin and Android Development featuring Jetpack” to give people a bit of extra info. There’s an overview video, a “Tips and Tricks” video, and one of me nerding out about the Android Baseball League. I also recorded myself opening up the first five physical copies of the book, which is a fun little extra. Book Overview Tips and Tricks Android Baseball League Book Unboxing ...

2021-06-26 · 1 min · Michael Fazio

ABL Push Notifications

I’d guess most people have a love/hate relationship with notifications. Often an app will display too many notifications, either annoying users or causing them to miss important notifications (ALERT OVERLOAD). Sometimes apps will instead be cautious with their notifications and users will miss out on important events. Either way, notifications are an essential part of a solid app experience. In particular, push notifications (ones initiated from a server) can be a perfect way to interact with your users....

2021-04-16 · 11 min · Michael Fazio

Building a Custom Android ListAdapter

This is a snippet from the book “Kotlin and Android Development featuring Jetpack” by Michael Fazio, covering how to build a ListAdapter class for a native (Kotlin-based) Android app. A ListAdapter class is used along with a RecyclerView to display a list of items. The ListAdapter handles connecting the proper row data to a layout and sending all that information into the RecyclerView. Create a Custom List Adapter The PlayerSummaryAdapter class is responsible for managing all the PlayerSummary items in our list and handling how they’re displayed....

2021-03-28 · 5 min · Michael Fazio

Building an Android Repository

This is a snippet from my book “Kotlin and Android Development featuring Jetpack” from the Pragmatic Bookshelf, covering how to build a Repository class for a native (Kotlin-based) Android app. Here, we’re building an Android app based on a game called “Penny Drop”, which has each player rolling a single six-sided die and placing pennies in slots based on what they rolled. We’ve already created a Room-backed database, so now we need a way to access that database from various locations in the app....

2021-03-28 · 8 min · Michael Fazio