Cannot resolve constructor ArrayAdapter
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.
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()
.
Try
import android.widget.ArrayAdapter;
This can as well solve the problem.