Skip to content

Instantly share code, notes, and snippets.

@agustinsivoplas
Created February 22, 2016 16:09
Show Gist options
  • Save agustinsivoplas/653c43b5fba6f7069e50 to your computer and use it in GitHub Desktop.
Save agustinsivoplas/653c43b5fba6f7069e50 to your computer and use it in GitHub Desktop.
refreshNavigationBar method
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
refreshNavigationBar();
}
protected void refreshNavigationBar() {
List<NavigationItem> items = new ArrayList<NavigationItem>();
try {
for (final Course course : courseManager.getActiveCourses()) {
items.add(new NavigationItem(R.drawable.ic_action_go_to_today, course.getName(), new NavigationItem.OnItemSelectedListener() {
@Override
public void selected() {
Intent activity = new Intent(getApplicationContext(), DigitalNotebookActivity.class);
activity.putExtra(Constants.COURSE_ID_PARAM, course.getId().intValue());
startActivity(activity);
}
}));
}
} catch (SQLException e) {
Log.e("HomeActivity", "Error to load active courses.", e);
}
mDrawerListView.setAdapter(new NavigationItemAdapter(this, items));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment