Error in the Arrayadapter

Asked

Viewed 134 times

1

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

Erro AdapterView

 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);
        }
    });
  • Please avoid making mistakes in screenshots, as it makes it impossible for other people with the same problem to find this question, as well as preventing screen reader users from taking advantage of the content.

  • @Pabloalmeida why I put the code below.

  • But he did not post the message that made you create the question. Whoever looks for it does not find it the way it is.

  • Blz dude. Next time I copy the bug and put it in my hand here. Thanks

1 answer

3


The builder of Arrayadapter expects to be passed an object of the type ArrayList<> but you’re passing an object like GoogleApiClient.

Alter

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);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.