2

I read this question, making me understand why I must override getDropDownView and getView within my SpinnerAdapter class:

SpinnerActionAdapter extends ArrayAdapter<String> implements SpinnerAdapter

The problem is I have the exact same code both in the getDropDownView and getView, which I do not think is a very beautiful solution.

Does everyone who uses SpinnerAdapter have this code duplicated as well? Does anyone have a better solution?

Note: My code is working perfectly so there is no need to post it; it just looks strange because I have a lot of duplicated code.

Community
  • 1
  • 1
Blaze Tama
  • 10,828
  • 13
  • 69
  • 129

1 Answers1

5

call getView from your getDropDownView and return result

@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
    return getView(position, convertView, parent);
}
Dmitry
  • 864
  • 7
  • 15