代码如下:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_titoli);
btt_backHome = (Button) findViewById(R.id.btt_backHome);
lV_titoli = (ListView) findViewById(R.id.lV_titoli);
eT_search = (EditText) findViewById(R.id.eT_search);
adapter = ArrayAdapter.createFromResource(this, R.array.titoli, android.R.layout.simple_list_item_1);
adapter_testi = ArrayAdapter.createFromResource(this, R.array.testi, android.R.layout.simple_list_item_1);
lV_titoli.setAdapter(adapter);
final Intent refresh = new Intent(this, activity_titoli.class);
final Intent to_Home = new Intent (this , Activity_Main.class);
final Intent to_Canzone_from_titoli = new Intent (this , activity_canzone.class);
eT_search.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 arg0, int arg1, int arg2,
int arg3) {
(activity_titoli.this).adapter.getFilter().filter(arg0);
}
});