Program: 187910
Project: 187910
Buggy source:
/** 
 * Hook up buttons, lists, and edittext with functionality.
 */
private void createView(){
  mLinearLayoutBackground=(LinearLayout)findViewById(R.id.background);
  mSpinnerListFilter=(Spinner)findViewById(R.id.spinner_listfilter);
  mSpinnerListFilter.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView parent,    View v,    int position,    long id){
      fillItems();
      setListTheme(loadListTheme());
      checkListLength();
      bindGTalkIfNeeded();
    }
    public void onNothingSelected(    AdapterView arg0){
      fillItems();
      checkListLength();
    }
  }
);
  mEditText=(EditText)findViewById(R.id.edittext_add_item);
  mEditText.setOnKeyListener(new OnKeyListener(){
    public boolean onKey(    View v,    int keyCode,    KeyEvent key){
      if (key.getAction() == key.ACTION_DOWN && keyCode == Integer.parseInt(getString(R.string.key_return))) {
        insertNewItem();
        return true;
      }
      ;
      return false;
    }
  }
);
  Button button=(Button)findViewById(R.id.button_add_item);
  button.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      insertNewItem();
    }
  }
);
  mLayoutParamsItems=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
  mListItems=(ListView)findViewById(R.id.list_items);
  mListItems.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView parent,    View v,    int pos,    long id){
      Cursor c=(Cursor)parent.getItemAtPosition(pos);
      if (mState == STATE_PICK_ITEM) {
        pickItem(c);
      }
 else {
        toggleItemBought(c);
      }
    }
  }
);
  mListItems.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView parent,    View v,    int position,    long id){
      checkListLength();
    }
    public void onNothingSelected(    AdapterView arg0){
      checkListLength();
    }
  }
);
  mListItems.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener(){
    public void onCreateContextMenu(    ContextMenu contextmenu,    View view,    ContextMenuInfo info){
      contextmenu.add(0,MENU_MARK_ITEM,R.string.mark_item,R.drawable.shoppinglistcleanup001b).setShortcut('1','m');
      contextmenu.add(0,MENU_EDIT_ITEM,R.string.edit_item,R.drawable.shoppinglistrename001b).setShortcut('2','e');
      contextmenu.add(0,MENU_DELETE_ITEM,R.string.delete_item,R.drawable.shoppinglistdelete001b).setShortcut('3','d');
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Hook up buttons, lists, and edittext with functionality.
 */
private void createView(){
  mLinearLayoutBackground=(LinearLayout)findViewById(R.id.background);
  mSpinnerListFilter=(Spinner)findViewById(R.id.spinner_listfilter);
  mSpinnerListFilter.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView parent,    View v,    int position,    long id){
      fillItems();
      setListTheme(loadListTheme());
      checkListLength();
      bindGTalkIfNeeded();
    }
    public void onNothingSelected(    AdapterView arg0){
      fillItems();
      checkListLength();
    }
  }
);
  mEditText=(EditText)findViewById(R.id.edittext_add_item);
  mEditText.setOnKeyListener(new OnKeyListener(){
    public boolean onKey(    View v,    int keyCode,    KeyEvent key){
      if (key.getAction() == key.ACTION_DOWN && keyCode == Integer.parseInt(getString(R.string.key_return))) {
        insertNewItem();
        return true;
      }
      ;
      return false;
    }
  }
);
  Button button=(Button)findViewById(R.id.button_add_item);
  button.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      insertNewItem();
    }
  }
);
  mLayoutParamsItems=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
  mListItems=(ListView)findViewById(R.id.list_items);
  mListItems.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView parent,    View v,    int pos,    long id){
      Cursor c=(Cursor)parent.getItemAtPosition(pos);
      if (mState == STATE_PICK_ITEM) {
        pickItem(c);
      }
 else {
        toggleItemBought(c);
      }
    }
  }
);
  mListItems.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView parent,    View v,    int position,    long id){
      checkListLength();
    }
    public void onNothingSelected(    AdapterView arg0){
      checkListLength();
    }
  }
);
  mListItems.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener(){
    public void onCreateContextMenu(    ContextMenu contextmenu,    View view,    ContextMenuInfo info){
      contextmenu.add(0,MENU_MARK_ITEM,0,R.string.mark_item).setIcon(R.drawable.shoppinglistcleanup001b).setShortcut('1','m');
      contextmenu.add(0,MENU_EDIT_ITEM,0,R.string.edit_item).setIcon(R.drawable.shoppinglistrename001b).setShortcut('2','e');
      contextmenu.add(0,MENU_DELETE_ITEM,0,R.string.delete_item).setIcon(R.drawable.shoppinglistdelete001b).setShortcut('3','d');
    }
  }
);
}