我在customlistview中搜索数据的过滤数据,但这个过滤只显示数据的第一个细节,我该怎么做才能解决问题?请给我一个建议.... 谢谢 这是来源
cari_data = (EditText) findViewById(R.id.ed_cari_pel);
cari_data.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
// TODO Auto-generated method stub
}
@Override
public void onTextChanged(CharSequence cs, int start, int before, int count) {
// TODO Auto-generated method stub
_tampilData.getFilter().filter(cs.toString());
}});
database = new DB_OpenHelper(this);
if (!database.checkDatabase()) {
try{
database.createDatabase();
}catch(IOException ioe){
throw new Error ("Unble to create database");
}
}
try{database.openDatabase();
}catch(SQLException sqle){
throw sqle;
}
listTampilData = (ListView) findViewById(R.id.list_pelajaran);
TampilDataPelajaran(view);
}
private void TampilDataPelajaran(View view) {
// TODO Auto-generated method stub
dbhelper = new DB_OpenHelper(this);
datapelajaran = dbhelper.getMainActiviyPel(nama);
tampilData = new ArrayList<ListBinder_Pelajaran>();
ListBinder_Pelajaran datpel;
arrkode = new String[datapelajaran.size()];
for (int i =0 ; i<datapelajaran.size();i++){
datpel = new ListBinder_Pelajaran();
_data = datapelajaran.elementAt(i);
arrkode[i] = _data.getNama_pel();
datpel.Nama_pel =_data.getNama_pel();
tampilData.add(datpel);
}
_tampilData = new Adapter_Pelajaran(tampilData, this);
listTampilData.setAdapter(_tampilData);
listTampilData.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
// TODO Auto-generated method stub
int listId = Integer.parseInt(String.valueOf(id));
Intent detil = new Intent (TampilPelajaran.this, DetailPelajaran.class);
detil.putExtra (namapel, arrkode[listId]);
detil.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
detil.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(detil);
}
});
}