Skip to content

Commit

Permalink
Merge pull request #11 from intrications/fix-alphabet-crash
Browse files Browse the repository at this point in the history
Fix crash when first loading AlphabetIndexer sample
  • Loading branch information
ManuelPeinado committed Jul 13, 2013
2 parents 9755fd3 + b9f3479 commit b0a698a
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,16 @@ private void initList(Cursor cursor) {
prefs.edit().putBoolean("dbInitialized", true).commit();
rebuildList();
}
if (adapter == null) {
adapter = new AlphabetIndexerCursorAdapter(savedInstanceState, this, cursor);
adapter.setOnItemClickListener(this);
ListView listView = getListView();
listView.setFastScrollEnabled(true);
adapter.setAdapterView(listView);
}
else {
adapter.changeCursor(cursor);
if (cursor.getCount() > 0) {
if (adapter == null) {
adapter = new AlphabetIndexerCursorAdapter(savedInstanceState, this, cursor);
adapter.setOnItemClickListener(this);
ListView listView = getListView();
getListView().setFastScrollEnabled(true);
adapter.setAdapterView(listView);
} else {
adapter.changeCursor(cursor);
}
}
}

Expand Down

0 comments on commit b0a698a

Please sign in to comment.