Today I updated AS to 3.1, but there was a serious bug. Call onBackPressed()
method of all activities that contains EditText
will lead
StackOverFlow Error ,Only appeared below Android 6.0 devices.
If i removed the EditText or hide the EditText in xml, the bug was gone.
But if i hide the EditText before onBackPressed()
method, like this
override fun onBackPressed() {
editText.visibility = View.GONE
super.onBackPressed()
}
,when i clicked back button
NullPointerException occurred
In short, if an activity contains a EditText, when i finish the activity the application will crash。
finish: call
onBackPressed()
orActivity.finish()
or click the Back button