casillas
casillas

Reputation: 16813

super constructor in CustomArrayAdapter

I am following the following tutorial. I am learning how to use/create a custom adapter. In the following code, super constructor is confusing me a little bit.

public class UsersAdapter extends ArrayAdapter<User> {
   public UsersAdapter(Context context, ArrayList<User> users) {
       super(context, 0, users);
      }   
    ......
}

When I use simple ArrayAdapter, ArrayAdapter constructor takes 3 paramaters : context, resource, and list.

ArrayAdapter<string> myArrayAdapter= new ArrayAdapter<string>(this,Android.Resource.Layout.SimpleItem1, myList)

The following super constructor also takes 3 paramaters, but the confusing part is the second argument which is 0. What does 0 represent in the following super constructor?

super(context, 0, users);

Upvotes: 0

Views: 60

Answers (1)

Mike
Mike

Reputation: 4570

It is the resource ID for a layout file containing your layout when the adapter will instantiate views. Why not reading the documentation first?

Upvotes: 1

Related Questions