I\'m constructing TableLayout dynamically. And I need TableRow has a gap in certain column position.
For example, I need row has ImageView on 3 and 5 position, next
Actually, the error seems quite logical at first glance on your code. Unless you table is created from xml and as the required number of rows, when you add a view at the index 2, this index does not exist. Try replacing this 2 by a 0, you will see that it works. So you just need to add empty ImageView the other indexes if you want to stick to yours.