What I'm trying to do is to show some data for a book like Title, Author, and a Cover, and beneath these data, to have a ListView containing a list of clickable chapters.
One way I've thought would be to have a ListView with different type of cells, where the first would contain the data, and the rest of them would be simple cells containing the chapters. The ListView binds to a custom CursorAdapter that implements the newView(...) and bindView(...) methods, which I don't know how to customise in order to return different types of cells based on the cell's position.
@Override
public void bindView(View view, Context context, Cursor cursor) {
TextView title = (TextView) view.findViewById(R.id.title);
title.setText(cursor.getString(cursor.getColumnIndex(Constants.TITLE)));
..
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(context);
View v = inflater.inflate(R.layout.bookcell, parent, false);
bindView(v, context, cursor);
return v;
}
How should I do that?
Thanks!