Comments (7)
- The
onDestroy
is not not guaranteed to be called So I generally put my unsubscribe calls is the onStop. For this example onPause is also fine. - It does recreate the subscription and the observable s. The issues is when you restart the fragment you lose the observable s and the new observable once again will skip the first event. So, you have to enter something in each field again before it will validate the fields.
from rxjava-android-samples.
Sorry you are also right in that _combineLatestEvents should be in onStart or onResume.
from rxjava-android-samples.
@marukami
Thank you for your reply.
- My concern here is that after the validation is passed and the app goes background and comes to foreground, the "Submit" button is kept enabled even if I changed inputs to invalid entries. The screen below shows the issue.
The only way to avoid this issue was to call _combineLatestEvents()
at onCreateView()
and _subscription.unsubscribe()
at onDestroy()
.
Calling _subscription.unsubscribe()
at onStop()
reproduced the issue as well. I was wondering if there is any other option to solve this.
new observable once again will skip the first event
Oh, I didn't know this function. I got your point. Thank you.
from rxjava-android-samples.
Instead of using skip you could use filter and prevent events from empty fields. So, that way when the fragment resumes form a valid state the Func3 is invoked, and editing any field will also invoke the Func3. I've made a fork you can see here CombineLastest with filter.
Only issue with doing it this way is you lose the invalid state when the field is empty. I'll work on dealing with that edge case after work.
from rxjava-android-samples.
So I added a skipWhile so it will now handle the empty field after editing use case. @kaushikgopal thoughts/suggestions on if this should be a PR?
from rxjava-android-samples.
@marukami great. This is a better solution. I would recommend this as a PR.
from rxjava-android-samples.
hey @tomoima525 : sorry for keeping this issue alive forever. over the course of the numerous changes, at some point, i changed the unsubscribing to happen onDestroyView
. This in concert with onCreateView
should do the trick.
if i'm missing something, feel free to chime in.
as always thanks @marukami for the insight on what was happening in the first place.
from rxjava-android-samples.
Related Issues (20)
- Observables Context?? HOT 1
- Rxjava 2 with Android new architecture components HOT 2
- Exceeds Dex Limit of 64k in its current state. HOT 1
- [Question] Help Needed HOT 1
- gc overhead limit exceeded?
- Mocking framework
- memory leak
- Wrapping an Android Method that requires return value
- Code of Examples
- After value change -> execute once HOT 5
- What does RotationPersist1WorkerFragment and RotationPersist2WorkerFragment do? HOT 1
- networkObserver get Exception so the final result is onError in your example when network fail even if localObeserver has data HOT 3
- Port to RxJava 2.0 HOT 12
- RxJava2: Create an examples handing backpressure HOT 2
- takeUntil optimized cache and network method and Gson parse model HOT 2
- RxJava 1 branch HOT 1
- Have you stopped maintaining this project? HOT 2
- GUI elements must not be accessed from non-main threads HOT 1
- You are using a private api (as of support library v25 and up) HOT 1
- Retrolambda is too difficult for beginners HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxjava-android-samples.