Cursor fetching performance in non UI thread
<p>I've got a performance problem while fetching data from a cursor in <code>AsyncTaskLoader</code>. Testing in android API level 10. For example 2 classes with cursor - <code>TestFragmentUI</code> fetching data in UI thread and <code>TestFragment</code> fetching data in none <code>UI thread</code>. </p>

<pre><code>public class TestFragment extends Fragment implements LoaderManager.LoaderCallbacks&lt;Object&gt; {
...

@Override
public void onActivityCreated(Bundle savedInstanceState) {
...
getLoaderManager().initLoader(0, null, this);
...
}

public android.support.v4.content.Loader&lt;Object&gt; onCreateLoader(
            int id, Bundle args) {
    return new Loader(getActivity());
}

class Loader extends AsyncTaskLoader&lt;Object&gt; {


    public Loader(Context context) {
        super(context);     
    }
    public Object loadInBackground() {
        ...
        DataBaseHelper helper = new DataBaseHelper(getContext());
        SQLiteDatabase database = helper.getReadableDatabase();
        long start = System.currentTimeMillis();
        Cursor data = database.rawQuery(String.format(SQL_LOAD, parametr), null);
        while (data.moveToNext()) {
            String number = data.getString(data.getColumnIndex("number"));
        }
        data.close();       
        Log.i(TAG, "load: " + (System.currentTimeMillis() - start));
        ... 
    }
}
...
}
</code></pre>

<p>and</p>

<pre><code>public class TestFragmentUI extends Fragment {
...

@Override
public void onActivityCreated(Bundle savedInstanceState) {
...
DataBaseHelper helper = new DataBaseHelper(getActivity());
SQLiteDatabase database = helper.getReadableDatabase();
...
long start = System.currentTimeMillis();
Cursor data = database.rawQuery(String.format(SQL_LOAD, parametr), null);
while (data.moveToNext()) {
String number = data.getString(data.getColumnIndex("number"));
}
data.close();
Log.i(TAG, "load: " + (System.currentTimeMillis() - start));
...
}

...
}
</code></pre>

<p>In emulator <code>TestFragment</code> class output time that is 10 times slower than output <code>TestFragmentUI</code> and visually it is very noticeable.</p>

<p>Any ideas?</p>
