所以我按照建议this实现了here适配器,现在我只是在使用我的Recycler视图适配器时遇到了麻烦。这是以下的java代码:
public class RVAdapter extends CursorRecyclerAdapter<RVAdapter.MyViewHolder> {
private LayoutInflater inflater;
CursorAdapter mCursorAdapter;
Context mContext;
//Cursor cursor;
//public Cursor mCursor;
MainInfo mainInfo;
ManagerDatabaseAdapter.ManagerHelper managerHelper;
public ManagerDatabaseAdapter managerDatabaseAdapter;
// public List<MainInfo> mainInfoList = Collections.emptyList();
public RVAdapter (Context context, Cursor cursor) {
super(cursor);
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_row, parent, false);
}
@Override
public void onBindViewHolder(MyViewHolder holder, Cursor cursor) {
}
@Override
public int getItemCount() {
//return mainInfoList.size();
return 0;
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView Title;
MyViewHolder(View itemView) {
super(itemView);
Title = (TextView) itemView.findViewById(R.id.Row_Header);
//Body = (TextView) itemView.findViewById(R.id.Row_Footer);
}
}
}
我不确定如何更改RVAdapter以使用适配器。谢谢!