2

I have this piece of code in my onViewCreated to request focus on my EditText .

someEditText.apply { post { requestFocus() } }

Let's say that the app is closed before that Runnable completes.

Is it possible to create a memory leak in such scenario and if so, how should I solve it?

  • 1
    No, you're posting it to the main thread and your Activity will get an `onDestroy` call on the main thread before it's gone. – Tenfour04 Jul 21 '20 at 16:54

0 Answers0