title: How to work a setOnEditorActionListener in a BottomSheet called from a Fragment?
body: <p>I'm currently developing an application using android-studio with Kotlin.</p>
  <p>I want to use my function when a <code>setOnEditorActionListener</code> in a <code>BottomSheet</code> called from a <code>Fragment</code> fires.</p>
  <p>But in my code <code>setOnEditorActionListener</code> doesn't fire.</p>
  <p>*I want to use my function at a point I add my comment in a <code>CountSettingFragment.kt</code> bellow:</p>
  <p>How can I resolve this problem?</p>
  <hr />
  <p>Here are the codes:</p>
  <p>build.gradle</p>
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android'
  apply plugin: 'kotlin-android-extensions'
  
  android {
      compileSdkVersion 28
      defaultConfig {
          applicationId &quot;com.sample.myapp&quot;
          minSdkVersion 16
          targetSdkVersion 28
          versionCode 1
          versionName &quot;1.0&quot;
          testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;
      implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
      implementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
  
      implementation &quot;com.google.android.material:material:1.1.0-alpha06&quot;
  
      def nav_version = '2.0.0'
      implementation &quot;androidx.navigation:navigation-fragment-ktx:$nav_version&quot;
      implementation &quot;androidx.navigation:navigation-ui-ktx:$nav_version&quot;
  
      implementation &quot;androidx.fragment:fragment-ktx:1.3.0-alpha04&quot;
  
      implementation 'com.google.android.material:material:1.0.0'
  
  }
  </code></pre>
  <hr />
  <p>MainActivity.kt</p>
  <pre><code>package com.sample.myapp
  
  import androidx.appcompat.app.AppCompatActivity
  import android.os.Bundle
  import androidx.navigation.findNavController
  import androidx.navigation.ui.NavigationUI.setupWithNavController
  import com.sample.myapp.fragments.SimpleDialogFragment
  import kotlinx.android.synthetic.main.activity_main.*
  
  class MainActivity : AppCompatActivity() {
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          val navController = findNavController(R.id.nav_host_fragment)
          setupWithNavController(bottom_navigation, navController)
  
      }
  }
  </code></pre>
  <p>activity_main.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout
  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  xmlns:tools=&quot;http://schemas.android.com/tools&quot;
  xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
  android:layout_width=&quot;match_parent&quot;
  android:layout_height=&quot;match_parent&quot;
  tools:context=&quot;.MainActivity&quot;
  android:orientation=&quot;vertical&quot;
  &gt;
  &lt;fragment
          android:id=&quot;@+id/nav_host_fragment&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;0dp&quot;
          android:layout_weight=&quot;1&quot;
          android:name=&quot;androidx.navigation.fragment.NavHostFragment&quot;
          app:navGraph=&quot;@navigation/navigation_graph&quot; /&gt;
  
  &lt;com.google.android.material.bottomnavigation.BottomNavigationView
          android:id=&quot;@+id/bottom_navigation&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_gravity=&quot;bottom&quot;
          android:background=&quot;?android:attr/windowBackground&quot;
          app:menu=&quot;@menu/bottom_navigation_menu&quot;/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>bottom_navigation_menu.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;menu xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
  
      &lt;item
              android:id=&quot;@+id/navi_history&quot;
              android:title=&quot;test&quot;
      /&gt;
     
  &lt;/menu&gt;
  </code></pre>
  <p>navigation_graph.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;navigation xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
              xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
              android:id=&quot;@+id/navigation_graph&quot;
              app:startDestination=&quot;@id/navi_history&quot;
  &gt;
  
  &lt;fragment android:id=&quot;@+id/navi_history&quot;
            android:name=&quot;com.sample.myapp.fragments.HistoryFragment&quot;
            android:label=&quot;HistoryFragment&quot;/&gt;
  
  &lt;/navigation&gt;
  </code></pre>
  <hr />
  <p>HistoryFragment.kt</p>
  <pre><code>package com.sample.myapp.fragments
  
  import android.os.Bundle
  import android.view.LayoutInflater
  import android.view.View
  import android.view.ViewGroup
  import android.widget.Button
  import androidx.fragment.app.Fragment
  import com.sample.myapp.R
  
  class HistoryFragment : Fragment() {
  
      override fun onCreateView(
          inflater: LayoutInflater, container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View? {
  
          val view = inflater.inflate(R.layout.fragment_history, container, false)
  
          val startCount = view.findViewById&lt;Button&gt;(R.id.startCount)
  
          startCount.setOnClickListener{
              val fm = activity!!.supportFragmentManager
              val bottomSheet = CountSettingFragment()
              bottomSheet.show(fm, &quot;navigation_bottom_sheet&quot;)
          }
  
          return view
      }
  }
  </code></pre>
  <p>fragment_history.xml</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:id=&quot;@+id/constraintLayout&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          tools:context=&quot;.fragments.HistoryFragment&quot;
  &gt;
      &lt;Button
              android:id=&quot;@+id/startCount&quot;
              android:text=&quot;bottom sheet&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              android:layout_marginTop=&quot;8dp&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot; android:layout_marginBottom=&quot;8dp&quot;
              app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
      /&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <hr />
  <p>CountSettingFragment.kt</p>
  <pre><code>package com.sample.myapp.fragments
  
  import android.os.Bundle
  import android.view.LayoutInflater
  import android.view.View
  import android.view.ViewGroup
  import android.view.inputmethod.EditorInfo
  import android.widget.EditText
  import com.google.android.material.bottomsheet.BottomSheetDialogFragment
  import com.sample.myapp.R
  
  class CountSettingFragment : BottomSheetDialogFragment() {
  
      override fun onCreateView(
          inflater: LayoutInflater, container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View? {
  
          val view = inflater.inflate(R.layout.fragment_count_setting, container, false)
  
          val editTextInitialNumber = view.findViewById&lt;EditText&gt;(R.id.editTextInitialNumber)
  
          editTextInitialNumber.setOnEditorActionListener { v, actionId, event -&gt;
              when (actionId) {
                  EditorInfo.IME_ACTION_DONE -&gt; {
                      print(&quot;checked&quot;)
                      // I want use my function here
                      true
                  }
                  else -&gt; false
              }
          }
          return view
      }
  }
  </code></pre>
  <p>fragment_count_setting.xml</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;.fragments.CountSettingFragment&quot;
  &gt;
  
      &lt;EditText
              android:id=&quot;@+id/editTextInitialNumber&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:inputType=&quot;number&quot;
              android:ems=&quot;10&quot;
              android:imeOptions=&quot;actionDone&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              android:layout_marginTop=&quot;32dp&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot;/&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <hr />
  <p>Android Studio : 3.3.2</p>