I'm trying to use .addView to add another LinearLayout to the ViewGroup.
I am getting the following error on LogCat:
05-21 16:23:04.096: E/AndroidRuntime(2086): FATAL EXCEPTION: main 05-21 16:23:04.096: E/AndroidRuntime(2086): java.lang.NullPointerException 05-21 16:23:04.096: E/AndroidRuntime(2086): at android.view.ViewGroup.addView(ViewGroup.java:3148) 05-21 16:23:04.096: E/AndroidRuntime(2086): at android.view.ViewGroup.addView(ViewGroup.java:3131)
This is the code being called:
final LinearLayout eventContainerSub =
                        (LinearLayout) findViewById(R.layout.event_container);
                final LinearLayout eventContainer =
                        (LinearLayout) findViewById(R.id.eventContainer);
                eventContainer.addView(eventContainerSub);
Here is the ViewGroup (the first linear layout):
<LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:animateLayoutChanges="true"
                android:id="@+id/eventContainer"
                android:weightSum="100"
                android:duplicateParentState="true">
And this is the (second) LinearLayout I'm adding to the (first one) LinearLayout above:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="horizontal"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:id="@+id/eventContainerSub">