Code example for SimpleCursorAdapter

Methods: getFilter, runQueryOnBackgroundThread

0
        mcontactFilter.addTextChangedListener(new TextWatcher() {
			public void onTextChanged(CharSequence s, int start, int b, int c) {}
			public void beforeTextChanged(CharSequence s, int st, int c, int a) {}
			 
			public void afterTextChanged(Editable s) {
				adapter.runQueryOnBackgroundThread(s);
				adapter.getFilter().filter(s.toString());
			} 
		}); 
 
 
        // Populate the contact list 
        String[] from = new String[] {col_display_name};
        int[] to = new int[] {android.R.id.text1};
        int layout = android.R.layout.simple_list_item_1;
        adapter = new SimpleCursorAdapter(this, layout, runQuery(null), from, to);
        adapter.setFilterQueryProvider(this);
        mContactList.setAdapter(adapter);
         
        mContactList.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {