Android Open Source - book Book List Adapter

From Project

Back to project page book.


The source code is released under:

MIT License

If you think the Android project book listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package book;
/*from w ww.  j  a  v  a2 s.  c o  m*/
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;


 *    adapter for listing the books in the booklistview

public class BookListAdapter extends ArrayAdapter<Book>{
  private List<Book> books;
  private Context context;
  public BookListAdapter(Context context, List<Book> books) {
    super(context, R.layout.booklistitem);
    this.context = context;
    this.books = books;
    if (books.size() > 0){
      for (Book bk : books){

  public View getView(int position, View convertView, ViewGroup parent) {
      LayoutInflater inflater = (LayoutInflater) context
      View rowView = inflater.inflate(R.layout.booklistitem, parent, false);
      TextView bookname = (TextView) rowView.findViewById(;     
    TextView wordcount = (TextView) rowView.findViewById(;
      wordcount.setText(new Integer( this.books.get(position).getCount() ).toString());
      return rowView;

Java Source Code List