Building upon the linked question this is what will work for you
String[] textArray = {"One", "Two", "Three", "Four","Five","Six"};
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(LinearLayout.VERTICAL);
for( int i = 0; i < textArray.length; i+=2 )
{
LinearLayout linearLayout1 = new LinearLayout(this);
linearLayout1.setOrientation(LinearLayout.HORIZONTAL);
TextView textView1 = new TextView(this);
textView1.setText(textArray[i]);
TextView textView2 = new TextView(this);
textView2.setText(textArray[i+1]);
linearLayout1.addView(textView1);
linearLayout1.addView(textView2);
linearLayout.addView(linearLayout1);
}
<mainLayout>.addView(linearLayout);
Further more you can add LinearLayout.LayoutParams
to set the content however you like. And if you'd like to center it then you can use weights