Error spinner android

0

The setOnItemSelectedListener method is not called. I'm trying to get an item value through spinner , but when I click on the item I want, nothing happens.

I created a TAG to check if the method is being called and I got no results. Here is the code:

adapter = new ArrayAdapter < String > (this, android.R.layout.simple_spinner_dropdown_item, listColab);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerProf.setAdapter(adapter);

spinnerProf.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
    @Override
    public void onItemSelected(AdapterView << ? > adapterView, View view, int i, long l) {
        Log.i(TAG, adapterView.getItemAtPosition(i).toString());
    }

    @Override
    public void onNothingSelected(AdapterView << ? > adapterView) {
        Log.i(TAG, "teste");

    }
});
    
asked by anonymous 10.09.2017 / 17:43

1 answer

0

I think I found the problem, it was in my arrayList made up of data from a WebService, I just can not explain the reason why the data was displayed as expected in my spinner , when creating another array, If you find the reason for the error I will return to complement the answer.

    
10.09.2017 / 19:20