title: Kotlin Cast EditText, TextView to View
body: <p>i have one static method in kotlin to hide soft keyboard, it works in java if i pass EditText, TextView as second parameter of method.</p>
  
  <p>But in kotlin it gives error,</p>
  
  <p><strong>Error:(56, 71) Type mismatch: inferred type is EditText? but View was expected</strong></p>
  
  <p>i tried to change View to EditText in function, but it doesn't work for TextView</p>
  
  <p>Also tried to change View to Any, but applicationWindowToken gives error.</p>
  
  <p>This is common function in app.</p>
  
  <pre><code>companion object {
          fun hideSoftKeyboard(activity: Activity, view: View) {
              val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
              imm.hideSoftInputFromWindow(view.applicationWindowToken, 0)
          }
      }
  </code></pre>