Re: [android-developers] To ContentProvide Sqlite DB or Not

2012-10-23 Thread Piren
I will look into that, thanks

On Monday, October 22, 2012 7:59:12 PM UTC+2, Kristopher Micinski wrote:

 On Mon, Oct 22, 2012 at 3:48 AM, Piren gpi...@gmail.com javascript: 
 wrote: 
  Why do you prefer ASyncTasks to Loaders? Since they are handicapped in 
 ICS, 
  isn't it better to stop using them? 
  

 Why do you think they're handicapped? ...  That doesn't make any sense. 

 kris 


-- 
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

Re: [android-developers] To ContentProvide Sqlite DB or Not

2012-10-23 Thread Piren
As Mark said, the default behavior for ASyncTasks since HC is to run in a 
serialized form... 
I've seen so many apps being updated to support ICS just to have users 
complain that suddenly the app is very slow (not sure why the devs didnt 
notice this during the QA phase, but it happens).




On Monday, October 22, 2012 7:59:12 PM UTC+2, Kristopher Micinski wrote:

 On Mon, Oct 22, 2012 at 3:48 AM, Piren gpi...@gmail.com javascript: 
 wrote: 
  Why do you prefer ASyncTasks to Loaders? Since they are handicapped in 
 ICS, 
  isn't it better to stop using them? 
  

 Why do you think they're handicapped? ...  That doesn't make any sense. 

 kris 


-- 
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

Re: [android-developers] To ContentProvide Sqlite DB or Not

2012-10-22 Thread Piren
Why do you prefer ASyncTasks to Loaders? Since they are handicapped in ICS, 
isn't it better to stop using them?

On Sunday, October 21, 2012 11:36:10 PM UTC+2, Mark Murphy (a Commons Guy) 
wrote:

 On Fri, Oct 19, 2012 at 8:13 PM, ncdroid jbl...@gmail.com javascript: 
 wrote: 
  Can someone please answer definitively for me the following: 
  
  Are ContentProviders required to use Loaders w/Sqlite? 

 No. If you really want to use loaders with SQLite directly, I have a 
 SQLiteCursorLoader that works without a ContentProvider: 

 https://github.com/commonsguy/cwac-loaderex 

  If ContentProviders are *not* required to use Loaders w/Sqlite, is there 
 any 
  recommended example which shows how to use the two together? 

 What is (are?) the two in this sentence? 

  If Sqlite has a recommended way to achieve functional parity to Loaders 
 with 
  another method, what is that method? 

 :: shrug :: 

 I use ordinary AsyncTasks myself, way more often than Loaders. 

 -- 
 Mark Murphy (a Commons Guy) 
 http://commonsware.com | http://github.com/commonsguy 
 http://commonsware.com/blog | http://twitter.com/commonsguy 

 _The Busy Coder's Guide to Android Development_ Version 4.2 Available! 


-- 
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

Re: [android-developers] To ContentProvide Sqlite DB or Not

2012-10-22 Thread Mark Murphy
On Mon, Oct 22, 2012 at 3:48 AM, Piren gpi...@gmail.com wrote:
 Why do you prefer ASyncTasks to Loaders?

Greater flexibility.

 Since they are handicapped in ICS,
 isn't it better to stop using them?

Since they are not handicapped in ICS, they are perfectly fine to use.
In fact, CursorLoader uses AsyncTask under the covers.

If by handicapped in ICS you mean the new default serialized
behavior for execute(), use executeOnExecutor() and opt into the full
thread pool.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

-- 
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


Re: [android-developers] To ContentProvide Sqlite DB or Not

2012-10-22 Thread Kristopher Micinski
On Mon, Oct 22, 2012 at 3:48 AM, Piren gpi...@gmail.com wrote:
 Why do you prefer ASyncTasks to Loaders? Since they are handicapped in ICS,
 isn't it better to stop using them?


Why do you think they're handicapped? ...  That doesn't make any sense.

kris

-- 
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


Re: [android-developers] To ContentProvide Sqlite DB or Not

2012-10-22 Thread ncdroid
Thanks a lot for your feedback Mark.  Do you have a rule of thumb you apply 
to decide on AsyncTasks vs Loaders?  For example, if you expect something 
to take less than x mins, use AsyncTask, otherwise use a Loader?

On Sunday, October 21, 2012 5:36:10 PM UTC-4, Mark Murphy (a Commons Guy) 
wrote:

 On Fri, Oct 19, 2012 at 8:13 PM, ncdroid jbl...@gmail.com javascript: 
 wrote: 
  Can someone please answer definitively for me the following: 
  
  Are ContentProviders required to use Loaders w/Sqlite? 

 No. If you really want to use loaders with SQLite directly, I have a 
 SQLiteCursorLoader that works without a ContentProvider: 

 https://github.com/commonsguy/cwac-loaderex 

  If ContentProviders are *not* required to use Loaders w/Sqlite, is there 
 any 
  recommended example which shows how to use the two together? 

 What is (are?) the two in this sentence? 

  If Sqlite has a recommended way to achieve functional parity to Loaders 
 with 
  another method, what is that method? 

 :: shrug :: 

 I use ordinary AsyncTasks myself, way more often than Loaders. 

 -- 
 Mark Murphy (a Commons Guy) 
 http://commonsware.com | http://github.com/commonsguy 
 http://commonsware.com/blog | http://twitter.com/commonsguy 

 _The Busy Coder's Guide to Android Development_ Version 4.2 Available! 


-- 
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

Re: [android-developers] To ContentProvide Sqlite DB or Not

2012-10-22 Thread Mark Murphy
On Mon, Oct 22, 2012 at 4:25 PM, ncdroid jbla...@gmail.com wrote:
 Thanks a lot for your feedback Mark.  Do you have a rule of thumb you apply
 to decide on AsyncTasks vs Loaders?  For example, if you expect something to
 take less than x mins, use AsyncTask, otherwise use a Loader?

CursorLoader and my loaders *use* AsyncTask under the covers. Hence,
time (take less than x mins) is not a particularly useful metric
here -- the behavior using Loaders or using AsyncTask directly should
be roughly equivalent.

If you like the Loader framework, use it, particularly if you are also
using a ContentProvider.

If you do not like the Loader framework, don't use it. Unlike, say,
trying to avoid EditText, the use of Loaders is purely optional. In
particular:

-- you can't use Loaders on API Level 10 and below unless you are also
inheriting from FragmentActivity

-- you can only use Loaders from an Activity, not a Service, at least at present

In those cases, your hands are tied: you have to avoid Loaders.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.2 Available!

-- 
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


Re: [android-developers] To ContentProvide Sqlite DB or Not

2012-10-22 Thread ncdroid
Thanks again for sharing your experience and guidance on this subject 
Mark.  After getting lost in the documentation for so many hours, nice to 
have this communicated in such matter of fact language.

On Monday, October 22, 2012 4:54:10 PM UTC-4, Mark Murphy (a Commons Guy) 
wrote:

 On Mon, Oct 22, 2012 at 4:25 PM, ncdroid jbl...@gmail.com javascript: 
 wrote: 
  Thanks a lot for your feedback Mark.  Do you have a rule of thumb you 
 apply 
  to decide on AsyncTasks vs Loaders?  For example, if you expect 
 something to 
  take less than x mins, use AsyncTask, otherwise use a Loader? 

 CursorLoader and my loaders *use* AsyncTask under the covers. Hence, 
 time (take less than x mins) is not a particularly useful metric 
 here -- the behavior using Loaders or using AsyncTask directly should 
 be roughly equivalent. 

 If you like the Loader framework, use it, particularly if you are also 
 using a ContentProvider. 

 If you do not like the Loader framework, don't use it. Unlike, say, 
 trying to avoid EditText, the use of Loaders is purely optional. In 
 particular: 

 -- you can't use Loaders on API Level 10 and below unless you are also 
 inheriting from FragmentActivity 

 -- you can only use Loaders from an Activity, not a Service, at least at 
 present 

 In those cases, your hands are tied: you have to avoid Loaders. 

 -- 
 Mark Murphy (a Commons Guy) 
 http://commonsware.com | http://github.com/commonsguy 
 http://commonsware.com/blog | http://twitter.com/commonsguy 

 _The Busy Coder's Guide to Android Development_ Version 4.2 Available! 


-- 
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

Re: [android-developers] To ContentProvide Sqlite DB or Not

2012-10-21 Thread Mark Murphy
On Fri, Oct 19, 2012 at 8:13 PM, ncdroid jbla...@gmail.com wrote:
 Can someone please answer definitively for me the following:

 Are ContentProviders required to use Loaders w/Sqlite?

No. If you really want to use loaders with SQLite directly, I have a
SQLiteCursorLoader that works without a ContentProvider:

https://github.com/commonsguy/cwac-loaderex

 If ContentProviders are *not* required to use Loaders w/Sqlite, is there any
 recommended example which shows how to use the two together?

What is (are?) the two in this sentence?

 If Sqlite has a recommended way to achieve functional parity to Loaders with
 another method, what is that method?

:: shrug ::

I use ordinary AsyncTasks myself, way more often than Loaders.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.2 Available!

-- 
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