Try volatile https://docs.oracle.com/javase/tutorial/essential/concurrency/atomic.html
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/7f0dde35-cc3e-4374-9ef5-cde10121e619%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

