Code example for CompoundButton

Methods: getText, getContext

0
	 
	class AddRowListenerx implements OnCheckedChangeListener
	{ 
		public void onCheckedChanged(CompoundButton arg0, boolean arg1) 
		{ 
	    	GroceryListDao groceryListDao = new GroceryListDao(arg0.getContext());
	    	groceryListDao.open();
			String text = arg0.getText().toString();
			if("".equals(text)) return;
			 
			groceryListDao.createItem(text, 1);
			groceryListDao.close();
		} 
	} 
}