Why The constructor ArrayAdapter(new View.OnKeyListener(){}, int, String[]) is undefined

前端 未结 4 1324
南笙
南笙 2021-01-18 01:54

Why The constructor ArrayAdapter(new View.OnKeyListener(){}, int, String[]) is undefined in following my coding. This coding is for fetching data from SQLite when typing wor

4条回答
  •  不知归路
    2021-01-18 02:29

    I know this is ridiculously late but I usually use getActivity() in this circumstance. So it would look like this:

    ArrayAdapter adapter = new ArrayAdapter(getActivity(), R.layout.autosuggest, countries);
    ed1.setAdapter(adapter); 
    

提交回复
热议问题