Changed cursor management after seeing problems in Honeycomb. Stop using managed cursors and use changeCursor.
This commit is contained in:
parent
125162bcbe
commit
9b56d151d2
@ -5,10 +5,8 @@ import net.sf.openrocket.android.db.DbAdapter;
|
|||||||
import net.sf.openrocket.android.db.MotorDao;
|
import net.sf.openrocket.android.db.MotorDao;
|
||||||
import net.sf.openrocket.android.util.AndroidLogWrapper;
|
import net.sf.openrocket.android.util.AndroidLogWrapper;
|
||||||
import net.sf.openrocket.android.util.PersistentExpandableListFragment;
|
import net.sf.openrocket.android.util.PersistentExpandableListFragment;
|
||||||
import net.sf.openrocket.motor.Motor;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
@ -80,10 +78,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener
|
|||||||
protected Cursor getChildrenCursor(Cursor arg0) {
|
protected Cursor getChildrenCursor(Cursor arg0) {
|
||||||
AndroidLogWrapper.d(MotorListFragment.class,"getChildrenCursor");
|
AndroidLogWrapper.d(MotorListFragment.class,"getChildrenCursor");
|
||||||
String group = arg0.getString(arg0.getColumnIndex(groupColumn));
|
String group = arg0.getString(arg0.getColumnIndex(groupColumn));
|
||||||
AndroidLogWrapper.d(MotorListFragment.class," for: "+ groupColumn + " = " + group);
|
|
||||||
Cursor c = mDbHelper.getMotorDao().fetchAllInGroups(groupColumn,group);
|
Cursor c = mDbHelper.getMotorDao().fetchAllInGroups(groupColumn,group);
|
||||||
AndroidLogWrapper.d(MotorListFragment.class," got cursor");
|
|
||||||
getActivity().startManagingCursor(c);
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,17 +222,19 @@ implements SharedPreferences.OnSharedPreferenceChangeListener
|
|||||||
|
|
||||||
}
|
}
|
||||||
private void refreshData() {
|
private void refreshData() {
|
||||||
if (mAdapter != null ) {
|
|
||||||
mAdapter.changeCursor(null);
|
|
||||||
}
|
|
||||||
Cursor motorCursor = mDbHelper.getMotorDao().fetchGroups(groupColumn);
|
Cursor motorCursor = mDbHelper.getMotorDao().fetchGroups(groupColumn);
|
||||||
getActivity().startManagingCursor(motorCursor);
|
if (mAdapter != null ) {
|
||||||
// Set up our adapter
|
mAdapter.changeCursor(motorCursor);
|
||||||
mAdapter = new MotorHierarchicalListAdapter(
|
}
|
||||||
getActivity(),
|
else {
|
||||||
motorCursor,
|
// Set up our adapter
|
||||||
R.layout.motor_list_group,
|
mAdapter = new MotorHierarchicalListAdapter(
|
||||||
R.layout.motor_list_child);
|
getActivity(),
|
||||||
setListAdapter(mAdapter);
|
motorCursor,
|
||||||
|
R.layout.motor_list_group,
|
||||||
|
R.layout.motor_list_child);
|
||||||
|
setListAdapter(mAdapter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user