void setLabelsText() { // remove all first final int childCount = panelLabels.getChildCount(); if (childCount > 1) { panelLabels.removeViews(1, childCount - 2); } int pos = 1; for (Label label : labels) { panelLabels.addView(getLabelView(label), pos++); } }