Error "The ItemViewHolder class passed into the EasyAdapter is not valid, make sure it extends ItemViewHolder."
devloe opened this issue · 7 comments
What's wrong with my code?
I get the following error:
'05-21 12:20:26.893: E/AndroidRuntime(3300): uk.co.ribot.easyadapter.InvalidViewHolderException: The ItemViewHolder class passed into the EasyAdapter is not valid, make sure it extends ItemViewHolder.'
And my code look like this:
EasyAdapter adapter = new EasyAdapter<Debate>(getActivity(), DebateViewHolder.class, itemList);
list.setAdapter(adapter);
@LayoutId(R.layout.item_debate)
public class DebateViewHolder extends ItemViewHolder<Debate> {
@ViewId(R.id.title)
TextView title;
@ViewId(R.id.username)
TextView username;
@ViewId(R.id.date_human)
TextView date_human;
@ViewId(R.id.comments_count)
TextView comments_count;
public DebateViewHolder(View view) {
super(view);
}
@Override
public void onSetValues(Debate item, PositionInfo positionInfo) {
title.setText(item.title);
username.setText(item.username);
}
}
Hi,
It looks like you forgot to add the data type. It should be extends ItemViewHolder<Debate>
.
Also if DebateViewHolder
is an inner class, then it has to be static
. Otherwise the EasyAdapter won't be able to instantiate it.
Solved it.
I had to move the class to a file, loke DebateViewHolder.java.
Thanks!
Ok got it. Thanks.
No problem!
On setting proguard shows error
@gobinda99 you have to tell proguard to keep all the classes that extend ItemViewHolder
Thanks for your reply
I have fixed it ...
On 25 November 2014 at 04:08, Ivan Carballo notifications@github.com
wrote:
@gobinda99 https://github.com/gobinda99 you have to tell proguard to
keep all the classes that extend ItemViewHolder—
Reply to this email directly or view it on GitHub
#7 (comment).