question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update README instructions for converting existing ViewHolders

See original GitHub issue

I’m using trying to convert an existing Java ViewHolder to use with Groupie. In the docs the only thing I can find about this is under the Kotlin section (I’m only sadly using Java and not Kotlin, but the Kotlin section was the only place that mentioned existing ViewHolders) and it says

If you’re converting existing ViewHolders, you can leave them as they are by making an Item<MyViewHolder>.

The way I interpret that is that, if I leave my existing ViewHolder alone I should be able to use it seamlessly with Groupie.

public static class MyViewHolder extends RecyclerView.ViewHolder {
        //TextViews and stuff
        public MyViewHolder(View itemView) {
            super(itemView);
           //Butterknife.bind(...)
        }
       //bindTo(){
       //Method recommended by Yigit to be implemented in each VH to handle the actual binding
      //}
}

This existing RecyclerView.ViewHolder lives in MyCustomAdapter.java

Now I go to create my Item since I want to use Groupie.

public class MyItem extends Item<MyCustomAdapter. MyViewHolder>{

    @Override
    public void bind(@NonNull MyCustomAdapter. MyViewHolder viewHolder, int position) {
    //bind
    }

    @Override
    public int getLayout() {
        return R.layout.my_item;
    }
}

I get an error message in the IDE on the first line of the last code snippet (public class MyItem extends Item< MyCustomAdapter. MyViewHolder>{) specifically under <MyCustomAdapter. MyViewHolder> that says

Type parameter com.myapp.MyCustomAdapter.MyViewHolder is not within its bound; should extend com.xwray.groupie.ViewHolder

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lisawraycommented, Jan 15, 2018

I updated the README to explicitly include a section on legacy viewholders. If you think it could be more clear PRs welcome 😃

1reaction
lisawraycommented, Jan 12, 2018

Thank you so much @aayushthakur . It’s unbelievable that I solved this problem and have now forgotten (twice) that I did so.

I will make a point to update the README to explain. It’s not difficult but it’s definitely not intuitive!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to update RecyclerView Adapter Data - Stack Overflow
This is a general answer. The various ways to update the adapter data are explained. The process includes two main steps every time:...
Read more >
Keep Your README Install Instructions Up To Date - DockYard
A simple unit test ensures compatibility between your Elixir app's current version and the version constraint in your README's installation ...
Read more >
ReadMe
Developer hubs that meet your users where they are. ReadMe transforms your API docs into interactive hubs that help developers succeed. Get Started....
Read more >
Update recycler view content without refreshing the data.
Avoid graphical glitches by modifying specific ViewHolder items without redrawing them. Showing information in a list, or a set of cards is ...
Read more >
README.md template | Documenting your project - Drupal
## Recommended modules [Markdown filter](https://www.drupal.org/project/markdown): When enabled, display of the project's README.md help will be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found