How to convert my linearLayout to GridView/GridLayout
<p>How can I convert my linear layout as seen below to a grid view? So basically I need it to be 3 columns and 2 rows (in landscape orientation). No borders also.</p>

<p>The sample project is uploaded <strong><a href="https://dl.dropboxusercontent.com/u/70475776/multiPlayer.zip" rel="nofollow noreferrer">here</a></strong>.</p>

<p><a href="https://i.stack.imgur.com/vta6w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vta6w.png" alt="enter image description here"></a></p>

<pre><code>   &lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" &gt;

        &lt;SurfaceView
            android:id="@+id/video_1_surfaceview"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1" /&gt;

        &lt;SurfaceView
            android:id="@+id/video_2_surfaceview"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1" /&gt;

        &lt;SurfaceView
            android:id="@+id/video_3_surfaceview"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1" /&gt;

        &lt;SurfaceView
            android:id="@+id/video_4_surfaceview"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1" /&gt;

        &lt;SurfaceView
            android:id="@+id/video_5_surfaceview"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1" /&gt;

        &lt;SurfaceView
            android:id="@+id/video_6_surfaceview"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1" /&gt;

    &lt;/LinearLayout&gt;
</code></pre>

<p><strong>UPDATE:</strong> And this is my onCreate() method and initialization in the class:</p>

<pre><code>public class MultipleVideoPlayActivity extends Activity implements OnBufferingUpdateListener, OnCompletionListener, OnPreparedListener, OnVideoSizeChangedListener, SurfaceHolder.Callback {

    private static final String TAG = "MediaPlayer";
    private static final int[] SURFACE_RES_IDS = { R.id.video_1_surfaceview, R.id.video_2_surfaceview };

    private MediaPlayer[] mMediaPlayers = new MediaPlayer[SURFACE_RES_IDS.length];
    private SurfaceView[] mSurfaceViews = new SurfaceView[SURFACE_RES_IDS.length];
    private SurfaceHolder[] mSurfaceHolders = new SurfaceHolder[SURFACE_RES_IDS.length];
    private boolean[] mSizeKnown = new boolean[SURFACE_RES_IDS.length];
    private boolean[] mVideoReady = new boolean[SURFACE_RES_IDS.length];
    int i = 0; // index of video playout

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
         setContentView(R.layout.multi_videos_layout);

        // create surface holders
        for (int i = 0; i &lt; mSurfaceViews.length; i++) {
            mSurfaceViews[i] = (SurfaceView) findViewById(SURFACE_RES_IDS[i]);
            mSurfaceHolders[i] = mSurfaceViews[i].getHolder();
            mSurfaceHolders[i].addCallback(this);
            mSurfaceHolders[i].setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        }
    }
</code></pre>