Dear Stackoverflow community,
i have a pretty wierd problem. First of all i built some kind of a "chooser" activity, which is nothing more than a WheelView on the left side, a Coverflow in the center and another (smaller) coverflow beneath that. Btw. a CoverFlow is a Gallery with some logic overridden.
The center coverflow uses a BaseAdapter. I've created some set of Lists and each time my coverflow gets new content, i create a new instance of BaseAdapter with one of the lists. In my case this is done, when selecting an item in the lower CoverFlow. So i implemented an OnItemSelectedListener, to check when that happens. Scrolling this coverflow causes the view to "notifyDataSetChanged" always and change the adapter in some case. Now this works like a charm.
As i have lots of objects in this chooser (the center coverflow), i decided to continue using a CursorAdapter to increase performance. Now the CursorAdapter doesn't seem to have a notifyDataSetChanged() method, so i copied the same code-logic as the BaseAdapter and used this in mine. The lower Coverflow still uses the same adapter (in this case a ListAdapter, implementing a SpinnerAdapter). Now - when doing the exact same logic, the lower coverflow recenters itself after each notifyDataSetChanged() call on the center CoverFlowAdapter. I seriously don't get it. I will not post the whole logic here, as that would be about 5 classes, but the point in question is this one:
private OnItemSelectedListener itemSelListener = new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// if(!selectedByClicking){
switchModelType(arg1.getId());
// }
}
private void switchModelType(int id){
int oldMode = mode;
mode = id;
for(int i = 0; i < currentColors.length; i++){
if(currentColors[i] != null)
currentColors[i].isSelected = false;
}
if(currentColors[mode] != null)
currentColors[mode].isSelected = true;
if(coverFlow.getAdapter() != null){
((SelectionObjectCursorAdapter)
coverFlow.getAdapter()).notifyDataSetChanged();
// if(decorIsWooden)
// checkIfWoodDecorAdapter(oldMode);
}
}
The lower CoverFlow is not touched at any point in this part of code, nor is it anywhere in the class.