/**
  * Return a map source by id.
  *
  * @param id the map source id
  * @return the map source, or <tt>null</tt> if <tt>id</tt> does not correspond to a registered map
  *     source
  */
 @Nullable
 public static MapSource getMapSource(final int id) {
   for (final MapSource mapSource : mapSources) {
     if (mapSource.getNumericalId() == id) {
       return mapSource;
     }
   }
   return null;
 }
  public static void addMapviewMenuItems(final Menu menu) {
    final SubMenu parentMenu = menu.findItem(R.id.menu_select_mapview).getSubMenu();

    final int currentSource = Settings.getMapSource().getNumericalId();
    for (int i = 0; i < mapSources.size(); i++) {
      final MapSource mapSource = mapSources.get(i);
      final int id = mapSource.getNumericalId();
      parentMenu
          .add(R.id.menu_group_map_sources, id, i, mapSource.getName())
          .setCheckable(true)
          .setChecked(id == currentSource);
    }
    parentMenu.setGroupCheckable(R.id.menu_group_map_sources, true, true);
  }
 public static boolean isSameActivity(
     @NonNull final MapSource source1, @NonNull final MapSource source2) {
   final MapProvider provider1 = source1.getMapProvider();
   final MapProvider provider2 = source2.getMapProvider();
   return provider1 == provider2 && provider1.isSameActivity(source1, source2);
 }