Filtering with 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);
}
}
I am getting a blank output when I type anything in the editText Box. Please tell me if the searching technique is wrong.
链接地址: http://www.djcxy.com/p/93390.html上一篇: 如何在Android中将Focuschange Listner添加到listview
下一篇: 用RecyclerView过滤