嗨,我有一个问题,当我在简单的适配器上过滤数据时,我的应用程序崩溃并退出,我无法捕捉到错误,即使在一次尝试中,非常意想不到的是,我有另一个活动,只是与另一个查询的格式完全相同,它的工作正常。这是我的代码,如果有人可以帮助我,非常感谢提前
final SimpleAdapter cxcada = new SimpleAdapter(ListadoCXCActivity.this, cxclist, R.layout.cxclista, from, to);
lvcxc.setAdapter(cxcada);
//Search
buscarcxc.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
//here crash my app and exit without any log
cxcada.getFilter().filter(cs);
}
@Override
public void afterTextChanged(Editable s) {}
}); 发布于 2017-07-19 02:22:39
如果适配器有任何要防止的空值,过滤器将不起作用。必须验证不要在适配器中加载任何空值,我在前面的查询中修复了用来加载数据的
isnull(Column_Name, 'Default') as Column_Name发布于 2017-07-18 22:36:45
我以前在使用TextWatcher时遇到了一个错误。因为我在调用onTextChanged时更改了EditText中的单词。
你是不是像我一样这么做的?cxcada.getFilter().filter(cs);是否更改了您的EditText内容?
https://stackoverflow.com/questions/45169557
复制相似问题