knjk04 / Bookshelf

Android book wishlist app
GNU General Public License v3.0
1 stars 1 forks source link

Thumbnails not appearing in search results #15

Open knjk04 opened 5 years ago

knjk04 commented 5 years ago

Branch: experimental

Error:

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.drawee.view.SimpleDraweeView.setImageURI(android.net.Uri)' on a null object reference

Culprit: viewHolder.draweeView.setImageURI(uri);

The viewholder isn't null, the draweeview is. I'm doing Fresco.initialize(this) in SearchResultsActivity before calling the constructor on a bookListAdapter object reference. I'm doing the findViewById in the ViewHolder inner class in BookListAdapter, so it shouldn't be null.

The recyclerview cardview list won't show at all whilst the culprit is there.

If I do Fresco. initialize in SearchableActivity (before setContentView), in the ViewHolder constructor or in the BookListAdapter constructor, I get the 'Fresco has already been initialized' warning.

knjk04 commented 5 years ago

(I've also tried PIcasso instead of Fresco because Picasso doesn't require you to initialise it)

The code runs if you change

View view = inflater.inflate(R.layout.activity_search_results, viewGroup, false);

to:

View view = inflater.inflate(R.layout.single_list_row, viewGroup, false);

in onCreateViewHolder(), but the image still isn't showing, even if I don't set the image in onBindViewHolder().

UPDATE: the images are being set in the Preview Activity, but still not in the RecyclerView search results list.