How to Declare a LinearLayout, in Java

LinearLayout was added in API Level 1
A Layout that arranges its children in a single column or a single row

1. Add the below import to the import section.

import android.widget.LinearLayout;

2. Add the below code to the onCreate method. This will declare a new LinearLayout object named myLinearLayout.

LinearLayout myLinearLayout;