title: Kotlin synthetic view in activity gets null when a custom dialog is shown and dismissed
body: <p>I am updating a view in activity's onCreate method which is working fine using kotlin extension as stated below. </p>
  
  <blockquote>
    <p>Activity's <strong>onCreate</strong></p>
  </blockquote>
  
  <pre><code>import kotlinx.android.synthetic.main.activity_otpverification.*
  
       override fun onCreate(savedInstanceState: Bundle?) {
              super.onCreate(savedInstanceState)
              setContentView(R.layout.activity_otpverification)
              tvContactNumber.text = getString(R.string.dual_string_value_placeholder)
          }
  </code></pre>
  
  <p>Then at a click of a <strong>button</strong> I am showing a <strong>custom dialog</strong> for performing some action. When the dialog is <strong>dismissed</strong> I update the same <strong>textView</strong> in activity with the data sent from dialog, but the view <strong>tvContact</strong> is throwing null exception.</p>
  
  <blockquote>
    <p>Activity's <strong>onClick</strong></p>
  </blockquote>
  
  <pre><code>override fun onClick(p0: View?) {
      when (p0?.id) {
          R.id.ivEdit -&gt; {
              object : ChangeNumberDialog(this) {
                  override fun onSubmitClicked(number: String) {
                      tvContactNumber.text =number
                  }
              }.show()
          }
      }
  }
  </code></pre>
  
  <p><strong>onSubmitClicked</strong> is an abstract method in the dialog which is triggered when the dialog is dismissed.</p>
  
  <blockquote>
    <p>Error from logcat :</p>
  </blockquote>
  
  <pre><code>    java.lang.IllegalStateException: tvContactNumber must not be null
              at com.beat.em.ui.activities.OTPVerificationActivity$onClick$1.onSubmitClicked
  (OTPVerificationActivity.kt:211)
  </code></pre>
  
  <blockquote>
    <p><strong>onCreate</strong> and <strong>onClick</strong> methods from the <strong><em>ChangeNumberDialog</em></strong>:</p>
  </blockquote>
  
  <pre><code> override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          val view = layoutInflater.inflate(R.layout.dialog_change_number, null, false)
          setContentView(view)
          setCanceledOnTouchOutside(false)
          setCancelable(true)
          tvSubmit.setOnClickListener(this)
      }
  
    override fun onClick(view: View) {
      when (view.id) {
          R.id.tvSubmit -&gt; {
              onSubmitClicked(etNumber.text.toString().trim())
              dismiss()
            }
         }
    }
  </code></pre>
  
  <p>I have just started using kotlin extension and not able to understand the cause. Help appreciated.</p>