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

前端 未结 4 1350
南笙
南笙 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:42

    The keyword this points to the current instance of View.OnKeyListener class. The constructor of ArrayAdapter takes current context as first parameter which is your outer class name i.e., View (say MyActivity).

    You should use MyActivity.this instead of this.

提交回复
热议问题