I have an adapter that fills up a listview with textviews read from a json file (https://i.sstatic.net/jXUtY.jpg), now i want to add an autoCompleteTextView to the textviews talked about earlier so its possible to choose possible answers but when i try to add an Arrayadapter (to fill the autocompleteviews) inside my already excisting adapter it wont let me, any ideas how i should do this?
my current (not working) code:
public View getView(final int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {...}
else {...}
holder.editText.setHint(HintArrayList.get(position).getEditTextValue());
holder.editText.setThreshold(1);
---> // not possible?
---> ArrayAdapter adapter = new ArrayAdapter<String>
---> (this,android.R.layout.select_dialog_item, MainActivity.OptiesArray); //cannot resolve constructor 'ArrayAdapter'
holder.editText.setAdapter(MainActivity.adapter);
Since you're already in an adapter, you cant reference this
as a context,
You can get the context from any view of your parent adapter.
ArrayAdapter adapter = new ArrayAdapter<String>(
this,
android.R.layout.select_dialog_item,
MainActivity.OptiesArray
)
ArrayAdapter adapter = new ArrayAdapter<String>(
holder.editText.getContext(),
android.R.layout.select_dialog_item,
MainActivity.OptiesArray
)