用RecyclerView过滤

public void onTextChanged(CharSequence s,int start,int before,int count){String m = editText.getText()。toString()。toLowerCase();

            data=new ArrayList<Data>();
            for(int i=0;i<Info.sname.length;i++)
            {
                String temp=Info.sname.toString().toLowerCase();
                if(m.equalsIgnoreCase(temp))
                {
                data.add(new Data(Info.sname[i]));
                }
                layoutManager = new GridLayoutManager(ServiceHomePage.this,2);
                recyclerView.setLayoutManager(layoutManager);
                adapter=new ServiceAdapter(data,ServiceHomePage.this);
                recyclerView.setAdapter(adapter);
            }
        }

当我在editText Box中输入任何内容时,我得到一个空白输出。 请告诉我,如果搜索技术是错误的。

链接地址: http://www.djcxy.com/p/93389.html

上一篇: Filtering with RecyclerView

下一篇: Search on ListView when the class extends ListActivity