Filtered list item opens the original list items' activity

后端 未结 4 938
不知归路
不知归路 2021-01-28 09:23

After a tremendous amount of time searching in here, and everywhere else I am hopeless to find a solution.

So here is my problem.

I have created a list-

4条回答
  •  一生所求
    2021-01-28 09:44

    As from my previously answered question here, you have to override the getItem(position) method in your CustomAdapter. You are setting the onItemClick somewhat correctly but the list adapter doesn't know what exactly it's getting from getItem(position).

    EDIT (details): You need to add something like this in your custom adapter -

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }
    

    You should already have the list in your custom adapter. If not, you can add a list reference to your CustomAdapter:

    private ArrayList> list;
    

    Then setting it using a setter in your Group activity:

    customAdapter.setList(searchResults);
    

提交回复
热议问题