Code example for TableRow

Methods: getChildAtgetChildCount

0
	private static boolean shouldUpdateTableRow(TableLayout tableLayout, int row, Stock stock1, Stock stock2) {
		boolean shouldUpdateTableRow = true;
 
		TableRow currentTableRow = (TableRow) tableLayout.getChildAt(row);
		if (currentTableRow != null) {
			StockTileViewHolder tile1 = (StockTileViewHolder) currentTableRow.getChildAt(0).getTag();
			StockTileViewHolder tile2 = currentTableRow.getChildCount() == 2
				? (StockTileViewHolder) currentTableRow.getChildAt(1).getTag()
				: null; 
 
			if (tile1 != null && (stock2 == null || tile2 != null)) {
				if (tile1.getStock().equals(stock1)) {
					if (stock2 != null && tile2.getStock().equals(stock2)) {
						shouldUpdateTableRow = false;
					} 
					else if (stock2 == null && tile2 == null) {
						shouldUpdateTableRow = false;
					} 
				} 
			} 
		}