Fixed index out of bounds.

This commit is contained in:
Dennis Guse
2019-07-20 13:47:54 +02:00
parent 3d99fab808
commit e22ff7742e
2 changed files with 4 additions and 8 deletions
@@ -472,12 +472,12 @@ public class TrackListActivity extends AbstractTrackActivity implements FileType
return true;
case R.id.track_list_export_all:
FileTypeDialogFragment.newInstance(R.id.track_list_export_all,
R.string.export_all_title, R.string.export_all_option, 4)
R.string.export_all_title, R.string.export_all_option)
.show(getSupportFragmentManager(), FileTypeDialogFragment.FILE_TYPE_DIALOG_TAG);
return true;
case R.id.track_list_import_all:
FileTypeDialogFragment.newInstance(R.id.track_list_import_all,
R.string.import_selection_title, R.string.import_selection_option, 2)
R.string.import_selection_title, R.string.import_selection_option)
.show(getSupportFragmentManager(), FileTypeDialogFragment.FILE_TYPE_DIALOG_TAG);
return true;
case R.id.track_list_delete_all:
@@ -52,15 +52,12 @@ public class FileTypeDialogFragment extends AbstractMyTracksDialogFragment {
private static final String KEY_MENU_ID = "menuId";
private static final String KEY_TITLE_ID = "titleId";
private static final String KEY_OPTION_ID = "optionId";
private static final String KEY_SIZE = "size";
public static FileTypeDialogFragment newInstance(
int menuId, int titleId, int optionId, int size) {
public static FileTypeDialogFragment newInstance(int menuId, int titleId, int optionId) {
Bundle bundle = new Bundle();
bundle.putInt(KEY_MENU_ID, menuId);
bundle.putInt(KEY_TITLE_ID, titleId);
bundle.putInt(KEY_OPTION_ID, optionId);
bundle.putInt(KEY_SIZE, size);
FileTypeDialogFragment fileTypeDialogFragment = new FileTypeDialogFragment();
fileTypeDialogFragment.setArguments(bundle);
@@ -81,12 +78,11 @@ public class FileTypeDialogFragment extends AbstractMyTracksDialogFragment {
@Override
protected Dialog createDialog() {
int size = getArguments().getInt(KEY_SIZE);
int optionId = getArguments().getInt(KEY_OPTION_ID);
final int titleId = getArguments().getInt(KEY_TITLE_ID);
final int menuId = getArguments().getInt(KEY_MENU_ID);
String[] choices = new String[size];
TrackFileFormat[] trackFileFormats = TrackFileFormat.values();
String[] choices = new String[trackFileFormats.length];
for (int i = 0; i < choices.length; i++) {
TrackFileFormat trackFileFormat = trackFileFormats[i];
choices[i] = getString(optionId, trackFileFormat.name(),