title: Problem ins spinner : it is not showing the selected item
body: <p>so here is my problem ...
  I'm trying to implement a spinner inside my an alert dialog (in kotlin)
  the items are displayed just fine, but my main problem is i can't get the selected item, and when i use println insted of the toast, i get the following : &quot;InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed&quot;</p>
  <p>Here is the code of MainActivity</p>
  <pre><code>button.setOnClickListener {
  
              val view = LayoutInflater.from(applicationContext).inflate(
                  R.layout.fragment_popup,
                  null
              )
  
              view.spinner01.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
                  override fun onItemSelected(
                      parent: AdapterView&lt;*&gt;?,
                      view: View?,
                      position: Int,
                      id: Long
                  ) {
  
                      Toast.makeText(
                          applicationContext,
                          resources.getStringArray(R.array.planet)[position],
                          Toast.LENGTH_SHORT
                      )
                          .show()
                      spinner01.setSelection(position)
                  }
  
                  override fun onNothingSelected(parent: AdapterView&lt;*&gt;?) {
                  }
              }
  
              val alert = CustomAlert()
              alert.showDialog2(this)
          }
  </code></pre>
  <p>here is the code of the class CustomAlert</p>
  <pre><code>class CustomAlert {
  
      fun showDialog2(activity: Activity?) {
  
          val dialog = Dialog(activity!!)
  
          dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
          dialog.setCancelable(false)
          dialog.setContentView(R.layout.fragment_popup)
  
          val dialogButton: Button = dialog.findViewById&lt;View&gt;(R.id.button3) as Button
          dialogButton.setOnClickListener {
              dialog.dismiss()
          }
          dialog.show()
      }
  }
  </code></pre>
  <p>and here is the ressources</p>
  <pre><code>&lt;string-array name=&quot;planet&quot;&gt;
          &lt;item&gt;option1&lt;/item&gt;
          &lt;item&gt;option2&lt;/item&gt;
          &lt;item&gt;option3&lt;/item&gt;
      &lt;/string-array&gt;
  </code></pre>
  <p>XML FILE :</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:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:id=&quot;@+id/constraintLayoutDescription&quot;
          android:layout_width=&quot;378dp&quot;
          android:layout_height=&quot;283dp&quot;
          android:backgroundTint=&quot;@color/white&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          app:layout_constraintVertical_bias=&quot;0.501&quot;&gt;
  
          &lt;TextView
              android:id=&quot;@+id/textView30&quot;
              android:layout_width=&quot;87dp&quot;
              android:layout_height=&quot;24dp&quot;
              android:layout_marginTop=&quot;16dp&quot;
              android:text=&quot;Desciption&quot;
              android:textColor=&quot;@color/black&quot;
              android:textSize=&quot;18dp&quot;
              android:textStyle=&quot;bold&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              app:layout_constraintHorizontal_bias=&quot;0.048&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
          &lt;androidx.appcompat.widget.AppCompatSpinner
              android:id=&quot;@+id/spinner01&quot;
              android:layout_width=&quot;352dp&quot;
              android:layout_height=&quot;22dp&quot;
              android:layout_marginTop=&quot;32dp&quot;
              android:entries=&quot;@array/planet&quot;
              android:spinnerMode=&quot;dropdown&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              app:layout_constraintHorizontal_bias=&quot;0.0&quot;
              app:layout_constraintStart_toStartOf=&quot;@+id/textView30&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/textView30&quot; /&gt;
  
  
          &lt;Button
              android:id=&quot;@+id/button3&quot;
              android:layout_width=&quot;351dp&quot;
              android:layout_height=&quot;44dp&quot;
              android:layout_marginTop=&quot;118dp&quot;
              android:backgroundTint=&quot;#FFCB00&quot;
              android:text=&quot;Envoyer&quot;
              app:layout_constraintEnd_toEndOf=&quot;@+id/spinner01&quot;
              app:layout_constraintHorizontal_bias=&quot;0.0&quot;
              app:layout_constraintStart_toStartOf=&quot;@+id/spinner01&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/spinner01&quot; /&gt;
  
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>