0

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.

enter image description here

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

enter image description here

In short, if an activity contains a EditText, when i finish the activity the application will crash。

finish: call onBackPressed() or Activity.finish() or click the Back button

Community
  • 1
  • 1
Yua
  • 23
  • 8
  • 2
    Possible duplicate of [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – Vidhi Dave Mar 29 '18 at 08:30
  • I am also using `onBackPressed()` but I am not getting this issue, I updated my studio to 3.1 too – Lucifer Mar 29 '18 at 08:32
  • Try `editText.setVisiblity.setVisibility(View.VISIBLE);` – Lucifer Mar 29 '18 at 08:33

1 Answers1

0

I downgraded AS to 3.0. Problem solved. This should be a bug in AS 3.1

Yua
  • 23
  • 8