-
Notifications
You must be signed in to change notification settings - Fork 422
StrictMode complaining, but i'm not sure if i have anything to worry about. #78
Comments
You need to That said, you want to be very careful about putting the Cursor into the stream directly (even if wrapped in this object) since it's very easy to create leaks and even easier to get a closed cursor. This is the whole reason the |
I guess my problem then would be that It's hard\impossible to bind a RecyclerView to a database result in a way that doesn't involve bringing all of the records into memory... any ideas on that? |
I guess if the Observable at the end of my chain emits the Query to the subscriber i could then just wrap the Cursor that comes from it - i think i see what you're getting at now. |
Yes. That would isolate interaction to a single, synchronous method where you can not only guarantee that it's always closed, but it frees you from having to worry about where threading happens in the chain and whether or not you are accidentally leaking an instance with an operator that buffers values. |
Cool, thanks for the help. |
@briandilley please can you provide corrected version of your code? |
@ginosian we use the class below to wrap a
|
@briandilley Thank you very much. Excellent explanation. I was looking for this kind of solution for almost 15 days. |
So i created a class called CursorListAdapter that extends from AbstractList and uses a Cursor as it's backing:
and then i created an
Observable.Operator
tolift(...)
Observable<SqlBrite.Query>
s into anObservable
of the given type:I see a StrictMode warning in my console about not calling
close
on the cursor and I'm wondering if that's something i need to worry about or not. Here's the warning:I'm relatively new to RxJava and SqlBrite - but my
Operator
should be properly closing theCursor
right?The text was updated successfully, but these errors were encountered: