android show keyboard programmatically
fun View.showKeyboard() = ViewCompat.getWindowInsetsController(this)
?.show(WindowInsetsCompat.Type.ime())
//Now you can just call editText.showKeyboard() to show the keyboard for the EditText
android show keyboard programmatically
fun View.showKeyboard() = ViewCompat.getWindowInsetsController(this)
?.show(WindowInsetsCompat.Type.ime())
//Now you can just call editText.showKeyboard() to show the keyboard for the EditText
how to open soft keyboard in android programmatically
class MainActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_message)
val editTextMessage = findViewById<EditText>(R.id.myEditeText)
showSoftKeyboard(this, editTextMessage)
}
private fun showSoftKeyboard(context: Context, v: View) {
val iim = context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
if (v.requestFocus()) {
iim.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT)
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us