Code example for TableRow

Methods: getChildAt, getChildCount

0
		etOperation = (EditText) findViewById(R.id.main_etOperation);
 
		TableLayout tbButtons = (TableLayout) findViewById(R.id.main_tbButtons);
		for (int i = 0; i < tbButtons.getChildCount(); i++) {
			TableRow row = (TableRow) tbButtons.getChildAt(i);
			for (int j = 0; j < row.getChildCount(); j++) {
				Button button = (Button) row.getChildAt(j);
				button.setOnClickListener(this);
			} 
		} 
	} 
 
	@Override 
	public void onClick(View view) {
		Button button = (Button) view;
		if (button.getId() == R.id.main_btClear) {
			expression.clear();
			etOperation.setText("");
			return; 
		} else if (button.getId() == R.id.main_btAddition) {
			addOperation("+"); 
4
CodeRank