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

How to reset the MaterialSpinner? #123

Open
bsoto24 opened this issue Mar 6, 2018 · 3 comments
Open

How to reset the MaterialSpinner? #123

bsoto24 opened this issue Mar 6, 2018 · 3 comments

Comments

@bsoto24
Copy link

bsoto24 commented Mar 6, 2018

I have 4 spinners whose values ​​depend on the selection of the others, when I select a value of the first spinner I update the value of the other spinner, I am working with the adapters to update the data and it does but visually the spinner does not reset to its value by default (with the hint). This is my code:

    @Override
    public void showDepartamentos(List<LocalidadTO> departamentos) {
        adapterDepartamentos.clear();
        adapterProvincias.clear();
        adapterDistritos.clear();
        adapterComplejos.clear();

        this.departamentos = departamentos;
        for (LocalidadTO l : departamentos) {
            adapterDepartamentos.add(l.getNombre());
        }

        adapterDepartamentos.notifyDataSetChanged();
        adapterProvincias.notifyDataSetChanged();
        adapterDistritos.notifyDataSetChanged();
        adapterComplejos.notifyDataSetChanged();

    }

My data is shown in the spinner but I just want the spinner to be visually reset by default with the hint

@JorgeBazarte
Copy link

I have the same problem, I also set a new adapter on the spinner and is not working.

@Briciovh
Copy link

Briciovh commented Mar 7, 2018

The .setSelection(position); for the current adapter on the spinner doesn't reset the initial spinner position.

@JorgeBazarte
Copy link

JorgeBazarte commented Mar 7, 2018

@pepitofriki I just found a solution, just set your selected position to 0 before clear the adapter.

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

3 participants