Error in ArrayAdapter

1

Does anyone know why you are giving this problem? After I changed the name of GoogleApiClient it gives this error = /

 private GoogleApiClient client;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    listView = (ListView) findViewById(R.id.listView);
    adapterClientes = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, client);
    listView.setAdapter(adapterClientes);

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> a, View v, int position, long id) {
            Object o = listView.getItemAtPosition(position);
        }
    });
    
asked by anonymous 03.10.2016 / 19:43

1 answer

3

The ArrayAdapter constructor expects you to pass an object of type ArrayList<> but you are passing an object of type GoogleApiClient .

Change

adapterClientes = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, client); 

for

adapterClientes = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, clientes);
    
03.10.2016 / 22:45