0

I am using AtomicInteger in my android app. Now I want to listen to AtomicInteger variable value changes, how can I listen?

private final AtomicInteger hostsCount = new AtomicInteger(0);
     hostsCount.set(10);
     hostsCount.set(101);

How can I listen to value changes? How to implement listener for value changes of this AtomicInteger variable?

Chaitanya Karmarkar
  • 1,425
  • 2
  • 7
  • 18

1 Answers1

-1

Have you had a look at RxJava? It has a Observable<T> that you can watch for changes. The documentation is here: http://reactivex.io/RxJava/javadoc/io/reactivex/Observable.html

Scott Johnson
  • 707
  • 5
  • 13