Rxlifecycle (iii): Pit

Source: Internet
Author: User

Pit 1
Observable.just ("Hello world!"). Compose ( This.<string>binduntilevent (Activityevent.pause)). FlatMap (NewFunc1<string, observable<long>>() {@Override PublicObservable<long>Call (String s) {returnObservable.interval (1, Timeunit.seconds); }}). Subscribe (NewAction1<long>() {@Override Public voidCall (Long along) {log.i (TAG,"..... oh,oh,no!! ..........." +along); }            });

When the activity life cycle paused

Will it be executed?? Will be ...

If you want to not do it all:

Observable.just ("Hello world!"). FlatMap (NewFunc1<string, observable<long>>() {@Override PublicObservable<long>Call (String s) {returnObservable.interval (1, Timeunit.seconds); }            })            //Fuck....here. Compose ( This.<long>binduntilevent (Activityevent.pause)). Subscribe (NewAction1<long>() {@Override Public voidCall (Long along) {log.i (TAG,"..... oh,oh,no!! ..........." +along); }            });
Pit 2
Observable.interval (1, Timeunit.seconds). Doonunsubscribe (NewAction0 () {@Override Public voidCall () {log.i (TAG,"Unsubscribing Subscription ..."); }}). Doonnext (NewAction1<long>() {@Override Public voidCall (Long along) {log.i (TAG,"........... fuck ..." +along); }}). FlatMap (NewFunc1<long, observable<string>>() {@Override PublicObservable<string>Call (Long along) {returnObservable.just (along + ""); }}). Compose ( This.<string>binduntilevent (Activityevent.pause)). Subscribe (NewAction1<string>() {@Override Public voidCall (String num) {log.i (TAG,"............ shit ..." +num); }            });

When the activity was paused,

LOG.I (TAG, "....... fuck ......................... ........ shit ..." + num);

Will not execute ...

And it unsubscribe.

Rxlifecycle (iii): Pit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.