Android Studio 4.0 Tutorial - Part 6
DJ Malone DJ Malone
42K subscribers
3,066 views
51

 Published On Aug 8, 2020

Today let's pass a productCode from our main RecyclerView Adapter to our ProductInfo Fragment which allows us to lookup all data for a given product.

First we'll switch our Navigation Components to use a productCode instead of a ProductName, extract a "data" class, then use Kotlin's find{} function to fetch the product, defaulting to null if it doesn't exist.

It's a best practice to pass a unique identifier instead of a product name. Sort of like single source of truth. Questions in the comments 🙂

View code here: https://github.com/danielmalone/Andro...

Connect with me on Twitter!   / danielmalone  

show more

Share/Embed