Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot pass a negative number to startActivtyForResult #269

Open
bekuno opened this issue Jan 22, 2021 · 0 comments
Open

cannot pass a negative number to startActivtyForResult #269

bekuno opened this issue Jan 22, 2021 · 0 comments

Comments

@bekuno
Copy link
Member

bekuno commented Jan 22, 2021

I have discovered a bug that we cannot pass a negative number to startActivtyForResult. We are doing this in the following snippet in the Directions Settings:

notificationSoundType.setOnPreferenceChangeListener((preference, o) -> {
                String newValue = (String) o;
                int result = Utils.parseInt(newValue);
                if (result == PreferenceValues.VALUE_GUIDING_WAYPOINT_SOUND_CUSTOM_SOUND) {
                    Intent intent = new Intent(Intent.ACTION_PICK);
                    intent.setType("audio/*");
                    if (!Utils.isIntentAvailable(intent)) {
                        intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
                    }
                    startActivityForResult(intent, R.string.pref_KEY_S_GUIDING_WAYPOINT_SOUND);
                } else {
                    Preferences.GUIDING_WAYPOINT_SOUND = result;
                }
                return true;
            });

I'll fix it right away in an own commit.

Source: https://stackoverflow.com/a/25529974

Originally posted by @SchoolGuy in #240 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant