简体   繁体   中英

How to Listen Value Change in Primitive Data Type (in this case: boolean)

I want to make some code which its execution is triggered by value change of a boolean in my Android project. does that means creating a listener? Would you mind showing a sample to me?

Without knowing anything of your application, I will suggest an implementation of the Observer pattern . There are examples for a Java implementation on the Wikipedia page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM