May 2022
Intermediate to advanced
688 pages
20h 12m
English
You will browse to this URL first by using your old friend the implicit intent. This intent will start up the browser with your photo URL.
The first step is to make your app listen for presses on an item in the RecyclerView. Update PhotoViewHolder to pass in a lambda expression that will be invoked with the Crime’s new photoPageUri property being passed in. Invoke the lambda expression when the root view is clicked.
Listing 23.2 Firing an implicit intent when an item is pressed (PhotoListAdapter.kt)
class PhotoViewHolder(
private val binding: ListItemGalleryBinding
) : RecyclerView.ViewHolder(binding.root) {
fun bind(galleryItem: GalleryItem, onItemClicked: (Uri) -> Unit) { binding.itemImageView.load(galleryItem.url) ...Read now
Unlock full access