custom listview adapter getView method being called multiple times, and in no coherent order

后端 未结 11 2261
情话喂你
情话喂你 2020-11-22 04:50

I have a custom list adapter:

class ResultsListAdapter extends ArrayAdapter {

in the overridden \'getView\' method I do a

11条回答
  •  轮回少年
    2020-11-22 05:40

    i made this solution, maybe is not the best one, but does the work...

    //initialize control string
    private String control_input = " ";
    

    then =

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
    
        View gridview = convertView;
    
        // change input_array for the array you use
        if (!control_input.equals(input_array[position])) {
            control_input = input_array[position];
    
            //do your magic
    
        } 
    
        return gridview;
    }
    

    hope it helps!

提交回复
热议问题