Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. timeObservable.subscribe(new Observer<Long>() {
  2.  
  3. long time = 0; // variable for demonstating how much time has passed
  4.  
  5. @Override
  6. public void onSubscribe(Disposable d) {
  7. time = System.currentTimeMillis() / 1000;
  8. }
  9. @Override
  10. public void onNext(Long aLong) {
  11. Log.d(TAG, "onNext: " + ((System.currentTimeMillis() / 1000) - time) + " seconds have elapsed." );
  12. }
  13. @Override
  14. public void onError(Throwable e) {
  15.  
  16. }
  17. @Override
  18. public void onComplete() {
  19.  
  20. }
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement