Android Open Source - book Selectable Word 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;
//  w w  w  .  j av a  2s  .c om
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;


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

 *  used to be selectableListAdapter
 *  but has evolved into list adapter where checkboxes are used to check items
 *  selected or not selected
public class SelectableWordListAdapter extends ArrayAdapter<String>{
  private List<String> words;
  private final Context context;
  public SelectableWordListAdapter(Context context) {
    super(context, R.layout.booklistitem);
    this.context = context;
    this.words = new ArrayList<String>();
  public void set(HashMap<String, List<String>> book){
    for (String word : book.keySet()){
  public View getView(int position, View convertView, ViewGroup parent) {
      LayoutInflater inflater = (LayoutInflater) context
      View rowView = inflater.inflate(R.layout.selectablewordlistitem, parent, false);   // get listitem xml    
      CheckBox item = (CheckBox) rowView.findViewById(; // find checkbox
      item.setText(this.words.get(position));  // put shit in the textfield
      rowView.setTag(this.words.get(position));  // put shit in the (check)box
      return rowView;

Java Source Code List