Cannot resolve constructor ArrayAdapter

瘦欲@ 提交于 2019-11-27 21:30:13

Change

 listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow, planetList);

to

 listAdapter = new ArrayAdapter<String>(getActivity(), R.layout.simplerow, planetList);

You can get Context in Fragment by using getActivity().

Replace this with activityName.this Change

listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow, planetList);

with

listAdapter = new ArrayAdapter<String>(activityName.this, R.layout.simplerow, planetList);

This solved for me using in asyncTask.

Souvik Dutta

Try

import android.widget.ArrayAdapter;

This can as well solve the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!