Copy constructor for cursors?
I am trying to create a temporary cursor that can iterate over my data set while leaving the data member cursor in place but when I move my temporary cursor it also moves the primary cursor because it appears the temp is c开发者_如何转开发reated as a reference to the primary cursor. Is there any way around this?
Cursor tempCurs = this.cursor;
tempCurs.moveToNext() // This also moves this.cursor
Cursor is a interface so making a copy constructor of it may be difficult. It sounds like all you really want to do is rememeber where you were so instead of using a copy you may consider keeping an int variable around of its current position then restoring the previous position.
精彩评论