Program: 84339
Project: 84339
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  tvNewItem=(AutoCompleteTextView)findViewById(R.id.tvNewItem);
  btnAddItem=(Button)findViewById(R.id.btnAddItem);
  lvItems=(ListView)findViewById(R.id.lvItems);
  mFactory=LayoutInflater.from(this);
  mCursor=getContentResolver().query(GroceryProvider.CONTENT_URI,GroceryProvider.ITEM_QUERY_COLUMNS,null,null,GroceryProvider.DEFAULT_SORT_ORDER);
  lvItems.setAdapter(new GroceryListAdapter(this,mCursor));
  lvItems.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      CheckedTextView cv=(CheckedTextView)view;
      boolean isChecked=!cv.isChecked();
      GroceryListActivity.toggle_item(getApplicationContext(),id,isChecked);
    }
  }
);
  lvItems.setOnItemLongClickListener(new OnItemLongClickListener(){
    public boolean onItemLongClick(    AdapterView<?> parent,    View view,    int position,    long id){
      GroceryListActivity.delete_item(getApplicationContext(),id);
      return false;
    }
  }
);
  btnAddItem.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      GroceryListActivity.add_item(getApplicationContext(),tvNewItem.getText().toString());
      tvNewItem.setText("String_Node_Str");
    }
  }
);
  tvNewItem.setOnKeyListener(new OnKeyListener(){
    public boolean onKey(    View v,    int keyCode,    KeyEvent event){
      if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) {
        GroceryListActivity.add_item(getApplicationContext(),tvNewItem.getText().toString());
        tvNewItem.setText("String_Node_Str");
        return true;
      }
      return false;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  tvNewItem=(AutoCompleteTextView)findViewById(R.id.tvNewItem);
  btnAddItem=(Button)findViewById(R.id.btnAddItem);
  lvItems=(ListView)findViewById(R.id.lvItems);
  mFactory=LayoutInflater.from(this);
  mCursor=getContentResolver().query(GroceryProvider.CONTENT_URI,GroceryProvider.ITEM_QUERY_COLUMNS,null,null,GroceryProvider.DEFAULT_SORT_ORDER);
  lvItems.setAdapter(new GroceryListAdapter(this,mCursor));
  lvItems.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      CheckedTextView cv=(CheckedTextView)view;
      boolean isChecked=!cv.isChecked();
      GroceryListActivity.toggle_item(getApplicationContext(),id,isChecked);
    }
  }
);
  lvItems.setOnItemLongClickListener(new OnItemLongClickListener(){
    public boolean onItemLongClick(    AdapterView<?> parent,    View view,    int position,    long id){
      GroceryListActivity.delete_item(getApplicationContext(),id);
      return true;
    }
  }
);
  btnAddItem.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      GroceryListActivity.add_item(getApplicationContext(),tvNewItem.getText().toString());
      tvNewItem.setText("String_Node_Str");
    }
  }
);
  tvNewItem.setOnKeyListener(new OnKeyListener(){
    public boolean onKey(    View v,    int keyCode,    KeyEvent event){
      if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) {
        GroceryListActivity.add_item(getApplicationContext(),tvNewItem.getText().toString());
        tvNewItem.setText("String_Node_Str");
        return true;
      }
      return false;
    }
  }
);
}