EN (Spinner) Firebase Exception: Found Conflicting getters for name: getAdapter

Asked

Viewed 49 times

0

I am making an application where I choose a number in the spinner and write that number in Firebase. this giving the following error:

inserir a descrição da imagem aqui

details about the spinner and how I’m recording in firebase

spinnercarrinho = (Spinner) findViewById(R.id.spinner_carrinho);
    // Create an ArrayAdapter using the string array and a default spinner layout
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.carrinho_string, android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    spinnercarrinho.setAdapter(adapter);
    spinnercarrinho.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            objetoRef.child("carrinho").child("spinnercarrinho").setValue(spinnercarrinho);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

1 answer

0

You are passing View Spinner to Firebase. Enquantp should pass the value obtained from Spinner:

objetoRef.child("carrinho").child("spinnercarrinho").setValue(spinnercarrinho.getSelectedItem().toString());

Browser other questions tagged

You are not signed in. Login or sign up in order to post.