Open Michenux opened 10 years ago
Could you please post the code you use the create and set the SimpleCursorAdapter
?
I initialize the adapter like this (in the onCreateView of my fragment) :
this.mAdapter = new SimpleCursorAdapter(this.getActivity(), R.layout.page, null, mAdapterFromColumns, mAdapterToViews, 0);
And when in the method onLoadFinished :
public void onLoadFinished(Loader
This method doesnot work with the FlipView (works with a listView)
I found a workaround, i delay the creation of the adapter :
@Override
public void onLoadFinished(Loader
if ( this.mAdapter == null ) {
this.mAdapter = new SimpleCursorAdapter(this.getActivity(),
R.layout.page, cursor, mAdapterFromColumns,
mAdapterToViews, 0); this.mAdapter.setViewBinder(this); mFlipView.setAdapter(this.mAdapter); } else { this.mAdapter.changeCursor(cursor); } }
2014/1/26 Emil Sjölander notifications@github.com
Could you please post the code you use the create and set the SimpleCursorAdapter?
— Reply to this email directly or view it on GitHubhttps://github.com/emilsjolander/android-FlipView/issues/31#issuecomment-33316231 .
What android version are you seeing this on?
4.4
2014/1/26 Emil Sjölander notifications@github.com
What android version are you seeing this on?
— Reply to this email directly or view it on GitHubhttps://github.com/emilsjolander/android-FlipView/issues/31#issuecomment-33319288 .
Looking up the source for SimpleCursorAdapter there are just comments on line 118 making it hard to track down what is actually happening.
Hi,
I can't make it work with a SimpleCursorAdapter. I got a nullpointerexception
java.lang.NullPointerException at SimpleCursorAdapter.bindView(SimpleCursorAdapter.java:118) at android.support.v4.widget.CursorAdapter.getView(CursorAdapter.java:256) at se.emilsjolander.flipview.FlipView.getView(FlipView.java:417) at se.emilsjolander.flipview.FlipView.fillPageForIndex(FlipView.java:382) at se.emilsjolander.flipview.FlipView.setFlipDistance(FlipView.java:367) at se.emilsjolander.flipview.FlipView.flipTo(FlipView.java:1124) at se.emilsjolander.flipview.FlipView.dataSetChanged(FlipView.java:226) at se.emilsjolander.flipview.FlipView.access$000(FlipView.java:33) at se.emilsjolander.flipview.FlipView$1.onChanged(FlipView.java:86) at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37) at android.widget.BaseAdapter.notifyDataSetChanged(BaseAdapter.java:50) at android.support.v4.widget.CursorAdapter.swapCursor(CursorAdapter.java:347)
The "from" in the SimpleCursorAdapter is null. It works well when i use a ListView instead of FlipView.