google-developer-training / android-basics-kotlin-mars-photos-app

Apache License 2.0
92 stars 193 forks source link

Android Basics: Load and display images from the Internet - Display a grid of images with a RecyclerView #81

Closed BrandonV94 closed 10 months ago

BrandonV94 commented 3 years ago

name: Android Basics Unit 4 issue about: Report problems with the Android Basics Unit 4 codelabs title: 'Android Basics Unit 4 issue:' labels: '' assignees: ''


URL of codelab https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#3

In which task and step of the codelab can this issue be found? Display a grid of images with a RecyclerView

Describe the problem There is an issue when trying to resolve the error with PhotoGridAdapter class. In the codelab it mentions that I should click the PhotoGridAdapter class and click the red bulb and select "Implement Members" from the drop down menu. However I do not get the red bulb upon clicking the class, instead I get a yellow bulb with no solution.

Steps to reproduce?

  1. Create the PhotoGridAdapter class file.
  2. Extended the PhotoGridAdapter class from ListAdapter.
  3. Fill in the constructor as mentioned in the code lab.
  4. Attempt to click and resolve the issue with the class.

Versions Android Studio version: 2020.3.1 Patch 2 API version of the emulator: N/A

Additional information Include screenshots if they would be useful in clarifying the problem. Screen Shot 2021-09-15 at 3 24 00 PM

alexmills commented 2 years ago

Hey @BrandonV94 I had the same problem...

The issue comes from Android Studio using the wrong automatic import for ListAdapter.

Instead of using

import android.widget.ListAdapter

Use the Androidx RecyclerView version

import androidx.recyclerview.widget.ListAdapter

And then you're back on the road 👍

tamarabuilds commented 2 years ago

@alexmills Thanks! Your solution helped me too. Much appreciated!!