CustomArrayAdapter Implementation:Unable to get the resource id

前端 未结 4 567
走了就别回头了
走了就别回头了 2021-01-19 01:12

I want to implement CustomArrayAdapter and following is the constructor I have written for my custom adapter

public CustomUsersAdapter(Context context, Array         


        
4条回答
  •  失恋的感觉
    2021-01-19 01:52

    I'm not quite sure what you're going to use your ArrayAdapter for, but one reason for using an ArrayAdapter is to display a listView of a layout depending on the array.

    Here is an example of what the constructor should look like

    public CustomListAdapter() {
        super(Activity_Main.class, R.layout.listview_item, array);
    }
    

    Here is what could be in your listview_item :

    
    
        
    
    
    

    Basically, the CustomListAdapter will generate X number of listview_item layouts height wise in a ListView, where X is the size of array.

    Hope this helps.

提交回复
热议问题