I have implemented a `spinner`(in dialog mode) in `ListView` which opens when clicked on button. But `OnItemSelectedListener` is not working in adapter.My `Adpater` code is below
:

```
public class MarkAttendanceAdapter extends ArrayAdapter implements                                                                                           SectionIndexer {

View v;
public MarkAttendanceAdapter(@NonNull Context context) {
    super(context, -1);
}

@Override
    public int getCount() {
        return super.getCount();
    }

@NonNull
    @Override
    public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
 v = LayoutInflater.from(context).inflate(R.layout.lv_child_mark_attendance, parent, false);
 final Spinner action_Spinner = (Spinner) v.findViewById(R.id.spinner_action);
 final ArrayList<ItemDataOfSpinner> list = new ArrayList<>();

        list.add(new ItemDataOfSpinner("Absent", R.drawable.icon_a));
        list.add(new ItemDataOfSpinner("Comp-Off", R.drawable.icons_o));
        list.add(new ItemDataOfSpinner("Half-Day", R.drawable.icon_h));
        list.add(new ItemDataOfSpinner("Weekly-Off", R.drawable.icon_w));
        list.add(new ItemDataOfSpinner("Holiday", R.drawable.icon_h));
        list.add(new ItemDataOfSpinner("Leave", R.drawable.icon_l));

        SpinnerAdapter spinnerAdapter = new SpinnerAdapter(context, R.id.txt, list);
        action_Spinner.setAdapter(spinnerAdapter);
        action_Spinner.setOnItemSelectedListener(new AdapterView.OnitemSelectedListener {
            @Override
            public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
                Log.d(TAG,"It Worked selected");
            }

            @Override
            public void onNothingSelected(AdapterView<?> adapterView) {
                Log.d(TAG,"It Worked but nothing selected");
            }
        });
return v;
}
}

```

If this wont worked or it is a bad practise should I use a dialog box instead?
All answers will be helpful. Thanks