Dianne, thank you very much!

2011/11/8 Dianne Hackborn <hack...@android.com>

> If you are closing the cursor yourself, you really shouldn't be having the
> framework manage the cursor at all.  I mean...  the point of having the
> framework manage the cursor is for it to close it (and otherwise manage it)
> for you.  If you are then going to try to close it yourself, you then get
> to fight with the framework about who owns it.
>
> Also, loaders are not tied to content providers.  If you have something
> else to load, you can make your own subclass of AsyncTaskLoader.
>
>
That said, the framework is really oriented around accessing data through
> content providers.  I think you'll find it simpler to just go with that
> rather than having to build up the various conveniences it already provides
> for them.
>
>
> 2011/11/7 Júlio Cesar Bueno Cotta <juliocbco...@gmail.com>
>
>> Can someone try to help me please? I really preciate if it happen.
>> I am stuck with the Android documentation.
>> Should I convert all my SQLite methods to use Content Providers?
>> Thanks in advance.
>>
>>
>> 2011/11/5 Júlio Cesar Bueno Cotta <juliocbco...@gmail.com>
>>
>>> Hi people,
>>> I think I need some help here.
>>> I did some search in the group and found this few 
>>> topics<https://groups.google.com/forum/#%21searchin/android-developers/startManagingCursor$20deprecated>about
>>>  my questions, so sorry if I am being silly.
>>>
>>> First, When should I close my Cursors? I always close them in the
>>> onPause method of an Activity (with the code bellow), and due a HoneyComb
>>> issue before "open" the Cursor I check if it's not null and "opened" to
>>> avoid the error described 
>>> here<https://groups.google.com/forum/#%21searchin/android-developers/startManagingCursor$20deprecated/android-developers/BlgTO-yQHX4/whQZ345ITb0J>
>>> :
>>>
>>> protected void onResume () {
>>>    if(cursor != null && !cursor.isClosed()){
>>>       stopManagingCursor(cursor);
>>>       cursor.close();
>>>    }
>>>    cursor = getCursorFromMySQLiteDataBase();
>>>    startManagingCursor(cursor);
>>>
>>>    //use cursor to fill a ListView ou Spinner
>>> }
>>>
>>> protected void onPause () {
>>>
>>>   if(cursor != null && !cursor.isClosed()){
>>>       stopManagingCursor(cursor);
>>>        cursor.close();
>>>      }
>>> }
>>>
>>> }
>>>
>>> Stop the cursor in onPause method seems to be a good thing because, when
>>> I call another Activity from this, the father Activity is paused, right? I
>>> also because when I close the app, onPause is also performed, right again?
>>>
>>> I know the startManagingCursor and StopManagingCursor is deprecated
>>> (this 
>>> page<http://developer.android.com/reference/android/app/Activity.html#startManagingCursor%28android.database.Cursor%29>says
>>>  it):
>>>
>>> "Use the new 
>>> CursorLoader<http://developer.android.com/reference/android/content/CursorLoader.html>class
>>>  with
>>> LoaderManager<http://developer.android.com/reference/android/app/LoaderManager.html>instead;
>>>  this is also available on older platforms through the Android
>>> compatibility package. "
>>>
>>> But CursorLoader and LoaderManager works just with ContentProviders,
>>> right? That I am doing (above code) it's a bad thing? I need to get a away
>>> to change all my databases methods to use only ContentProviders?
>>>
>>> The documentation is not very clear about it. 
>>> Here<http://developer.android.com/reference/android/content/ContentProvider.html>say:
>>>
>>> "If you don't need to share data amongst multiple applications you can
>>> use a database directly via 
>>> SQLiteDatabase<http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html>.
>>> "
>>>
>>> but how to keep managing my Cursors from SQLiteDatabase without use
>>> [start,stop]ManagingCursor (since it's deprecated and probably soon it will
>>> not be there)?
>>>
>>> Well, I made a lot of questions in this topic, I don't want to mess
>>> around, I am just lost in those questions.
>>>
>>> Sorry again if I am being not clear enough about, I tried to, English is
>>> not my first lang.
>>> Thanks in advance.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-developers@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>
>>
>>
>>
>> --
>>  Júlio Cesar Bueno Cotta
>> Bacharel em Ciência da Computação pela UFV
>> Mestrando em Ciência da Computação pela UFABC
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Júlio Cesar Bueno Cotta
Bacharel em Ciência da Computação pela UFV
Mestrando em Ciência da Computação pela UFABC

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to