title: findViewById Crashing App In New Activity
body: <p>I have searched through multiple similar questions on SO and have not found a solution that is working for me.  I created a blank activity and have the following code in it.  When <code>btnSignIn = findViewById(R.id.btnSignIn)</code> is commented out, the app runs fine.  Below is the code in my activity.</p>
  <pre><code>class LoginActivity : AppCompatActivity() {
      private lateinit var btnSignIn: Button
  
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_login)
          btnSignIn = findViewById(R.id.btnSignIn) 
      }
  }
  </code></pre>
  <p>Not sure if it matters or not, but <code>LoginActivity</code> is a blank activity that I created in addition to the <code>MainActivity</code> that was created upon project creation.  I also set the <code>LoginActivity</code> to load first with the app by changing my manifest.</p>
  <pre><code>&lt;application
      android:allowBackup=&quot;true&quot;
      android:icon=&quot;@mipmap/ic_launcher&quot;
      android:label=&quot;@string/app_name&quot;
      android:roundIcon=&quot;@mipmap/ic_launcher_round&quot;
      android:supportsRtl=&quot;true&quot;
      android:theme=&quot;@style/Theme.WaOCompanion&quot;&gt;
      &lt;activity
          android:name=&quot;.LoginActivity&quot;
          android:exported=&quot;true&quot;&gt;
          &lt;intent-filter&gt;
              &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
  
              &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity
          android:name=&quot;.MainActivity&quot;
          android:exported=&quot;true&quot;&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  <p>Update: added <code>activity_login.xml</code></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.LoginActivity&quot;&gt;
  
      &lt;TextView
          android:id=&quot;@+id/textView&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginTop=&quot;140dp&quot;
          android:fontFamily=&quot;sans-serif-medium&quot;
          android:text=&quot;WaO Companion&quot;
          android:textAppearance=&quot;@style/TextAppearance.AppCompat.Display1&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
      &lt;com.google.android.gms.common.SignInButton
          android:id=&quot;@+id/btnSignIn&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginTop=&quot;32dp&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toBottomOf=&quot;@+id/textView&quot; /&gt;
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>