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

Deleting last segment error #45

Open
bahaahany2019 opened this issue Nov 27, 2020 · 0 comments
Open

Deleting last segment error #45

bahaahany2019 opened this issue Nov 27, 2020 · 0 comments

Comments

@bahaahany2019
Copy link

bahaahany2019 commented Nov 27, 2020

Hi,
I create segments at runtime all working fine my problem is in deleting the last segment for example if i have 3 segments i can delete the first & second without any problems but if i tried to delete the third the app crashes below is the delete code please advice.

btnDeleteSeg.setOnClickListener(new` View.OnClickListener()
    {
        @Override
        public void onClick (View v){
        bibleSegIndex = segmentedButtonGroup.getPosition();
        if (bibleSegIndex == 0) {
            segmentedButtonGroup.setPosition(0, false);
        } else {
            segmentedButtonGroup.setPosition(0, true);
        }
        segmentedButtonGroup.getButton(bibleSegIndex).setVisibility(View.GONE);
        segmentedButtonGroup.getButtons().remove(bibleSegIndex);
    }
    }
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