I'm getting the following error:
Error:(34, 53) error: no suitable constructor found for ArrayAdapter(AllStores,ListView,Response<List<Store>>) constructor ArrayAdapter.ArrayAdapter(Context,int,int,List<String>) is not applicable (actual and formal argument lists differ in length) constructor ArrayAdapter.ArrayAdapter(Context,int,List<String>) is not applicable (actual argument ListView cannot be converted to int by method invocation conversion) constructor ArrayAdapter.ArrayAdapter(Context,int,int,String[]) is not applicable (actual and formal argument lists differ in length) constructor ArrayAdapter.ArrayAdapter(Context,int,String[]) is not applicable (actual argument ListView cannot be converted to int by method invocation conversion) constructor ArrayAdapter.ArrayAdapter(Context,int,int) is not applicable (actual argument ListView cannot be converted to int by method invocation conversion) constructor ArrayAdapter.ArrayAdapter(Context,int) is not applicable (actual and formal argument lists differ in length)
And this is what I have tried:
ArrayAdapter<String> stringArrayAdapter=new ArrayAdapter<String>( AllStores.this, lv, subprises);
I have also tried to replace the first parameter of ArrayAdapter
with this
, getApplicationContext()
or context
. Unfortunately it didn't worked. I have really no idea what I'm doing wrong.
Here below you can see my code if you want to see it:
AllStores.java:
public class AllStores extends Activity { private ListView lv; Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_all_stores); lv = (ListView) findViewById(R.id.store_list); Response<List<Store>> subprises; try { subprises = new StoreService().getSubprises(); Iterator it = subprises.body().iterator(); ArrayAdapter<String> stringArrayAdapter=new ArrayAdapter<String>( AllStores.this, lv, subprises); } catch (IOException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }