BoD/android-contentprovider-generator

Add setCursor to AbstractCursor to prevent extra initialization of model Cursors

R4md4c opened this issue · 2 comments

Hello,

I have a code that does something like this

cursor.moveToFirst();
do {
      UserCursor userCursor = new UserCursor(cursor);
      if (userCursor.getIsRegistered() != null && !userCursor.getIsRegistered()) {
               // do Something
       }
} while (cursor.moveToNext());

Instead of creating a new UserCursor each time, why don't we add a setCursor method and reuse the object instead of creating new one, I think that would save memory, right ?

Hello,
Do move to next on userCursor object instead of data.

Le mar. 7 avr. 2015 12:43, Ahmed I. Khalil notifications@github.com a
écrit :

Hello,

I have a code something like this

data.moveToFirst();
do {
UserCursor userCursor = new UserCursor(data);
if (userCursor.getIsRegistered() != null && !userCursor.getIsRegistered()) {
// do Something
}
} while (data.moveToNext());

Instead of creating a new UserCursor each time, why don't we use setCursor
and reuse the object instead of creating new one, I think that would be
saving memory, right ?


Reply to this email directly or view it on GitHub
#82.

Hi sgueniot,

Thanks for pointing this out, you are right. It will work this way.

I'll close this issue.