Android LinearLayout Programmatically Set Vertical or Horizontal

In Android you might want to set the orientation programmatically in Java for a LinearLayout. You do like this:

LinearLayout layout = new LinearLayout(this);
// or horizontal like this

LinearLayout.HORIZONTAL also got the integer value 0 and Vertical got 1.

Further take a look at LinearLayout | Android Developers