title: Kotlin Android Extensions giving Layout Null Pointer
body: <p>There is a fairly simple scenario that is giving me quite a bit of trouble. I'm making a very simple Activity with an embedded fragment. This fragment is simply a Gridview that displays some images. The issue comes when referring to the Gridview using Kotlin extensions to refer directly to an XML id. <strong>What is the issue here?
   Does kotlinx not work on static fragments?</strong></p>
  
  <p><em>Error:</em></p>
  
  <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.android_me/com.example.android.android_me.ui.MainActivity}: java.lang.IllegalStateException: gridview_all_parts must not be null
   Caused by: java.lang.IllegalStateException: gridview_all_parts must not be null                                                                                  at com.example.android.android_me.ui.MasterListFragment.onActivityCreated(MasterListFragment.kt:22)
  </code></pre>
  
  <p><em>Fragment with offensive line of code</em></p>
  
  <pre><code>import kotlinx.android.synthetic.main.fragment_master_list.*
  
      class MasterListFragment: Fragment() {
  
          override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
              val layoutView = inflater?.inflate(R.layout.fragment_master_list, container, false)
              return layoutView
          }
  
          override fun onActivityCreated(savedInstanceState: Bundle?) {
              //If this is removed, code runs
              gridview_all_parts.adapter = MasterListAdapter(activity, AndroidImageAssets.getAll())
              super.onActivityCreated(savedInstanceState)
          }
      }
  </code></pre>
  
  <p><em>Fragment Layout:</em></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;GridView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/gridview_all_parts"
      android:layout_width="match_parent" android:layout_height="match_parent"/&gt;
  </code></pre>
  
  <p><em>Parent Activity Layout</em></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--have tried both class:= and android:name:=--&gt;
  &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
      class="com.example.android.android_me.ui.MasterListFragment"
      android:id="@+id/fragment_masterlist"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      /&gt;
  </code></pre>
  
  <p><em>Parent Activity</em></p>
  
  <pre><code>class MainActivity: AppCompatActivity(){
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
      }
  }
  </code></pre>