I am trying to implement TwoWayView in my project, following the sample project presented in this link. I implemented everything, and my code works without errors, but the actual list is not inflated. After debugging, I learned that the adapter is configured correctly, and the method getItemCountalso returns a positive score, but the other two overridden methods onCreateViewHolder, and onBindViewHolderare not called. I do not know why it does not work. See Partial Code below, any help is appreciated. Thanks.
class MyAdapter.java
public class MyAdapter extends RecyclerView.Adapter < MyViewHolder > {
private MySimpleCursorAdapter mCursor;
public MyAdapter(Context context, Cursor c, int resourceId, ViewType viewType, String containerId) {
mCursor = new MySimpleCursorAdapter(a1,a2,a3,a4,a5,a6);
....
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
Log.w("onCreateViewHolder", "--------->executed");
final View view = mCursor.newView(mContext, mCursor.getCursor(), parent);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
Log.w("onBindViewHolder", "--------->executed");
mCursor.bindView(holder.itemView, mContext, mCursor.getCursor());
}
@Override
public int getItemCount() {
Log.w("count", Integer.toString(mCursor.getCount()));
return mCursor.getCount();
}
private class MySimpleCursorAdapter extends SimpleCursorAdapter {
public MySimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) {
super(context, layout, c, from, to, flags);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View view = mLayoutInflater.inflate(mLayoutToInflate, null);
....
return view;
}
@Override
public void bindView(final View view, Context context, Cursor cursor) {
}
}
}
:. , , RecyclerView ScrollView, getItemCount .