how to open soft keyboard in android programmatically

Solutions on MaxInterview for how to open soft keyboard in android programmatically by the best coders in the world

showing results for - "how to open soft keyboard in android programmatically"
Gabriel
05 May 2017
1
2class MainActivity: AppCompatActivity() {
3
4	override fun onCreate(savedInstanceState: Bundle?) {
5        super.onCreate(savedInstanceState)
6        setContentView(R.layout.activity_message)
7		val editTextMessage = findViewById<EditText>(R.id.myEditeText)
8      	showSoftKeyboard(this, editTextMessage)
9    }
10
11
12  	private fun showSoftKeyboard(context: Context, v: View) {
13    	val iim = context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
14    	if (v.requestFocus()) {
15      		iim.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT)
16    	}
17  	}
18}
19