{SOLVED} Null Cursor after moving Adapter to separate .java

Exippitsbeife

New Member
I had it all working... then i made a decision to separate my Adapter into a new .java to use it from other Activities...However ever since doing this, i get a Java.lang.NullPointerException, from the deckCursor.moveToPosition line.Why isnt the cursor being passed / initialised with the query correctly?Main.java\[code\]static Cursor deckCursor;DeckCursorAdapter deckAdapter;public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); deckCursor = mtgDBAdapter.fetchAllDecks(); deckAdapter = new DeckCursorAdapter(this, deckCursor); startManagingCursor( deckCursor );}\[/code\]DeckCursorAdapter.java\[code\]class DeckCursorAdapter extends CursorAdapter { private Cursor deckCursor; public DeckCursorAdapter( Context context, Cursor cursor ) { super( context, cursor ); deckCursor = cursor; } @Override public View getView(int which, View convertView, ViewGroup parent) { deckCursor.moveToPosition(which); return convertView; }}\[/code\]EDIT:resolved -.-I believe ONE of the issues was that the Cursor in Main.java was 'static'A frustrating residual from some previous error from a case that no longer applies ...
 
Top