Android Filter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Filter class.

This code example shows how to use the following methods:filter
        searchViewStrategy = (Build.VERSION.SDK_INT >= HONEYCOMB) ? new HoneycombStrategy() : new LegacyStrategy();
        searchViewStrategy.setup(searchMenuItem, new SearchViewStrategy.OnFilterTextListener() {
            public void onFilterTextChange(String newText) {
                Filter filter = filterable.getFilter();
                if (filter != null)
                    filter.filter(newText);
            } 
 
            public void onFilterTextSubmit(String query) {
                Log.d(TAG, "onFilterTextSubmit : '"+query+"'");
                clearSearchViewOnSubmit(); 
            } 
        }); 
    } 
 
    public void onSearchRequested() { 
        searchMenuItem.expandActionView();
    } 
 
    /** 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:filter, toString
	 * @see android.text.TextWatcher#afterTextChanged(android.text.Editable) 
	 */ 
	@Override 
	public void afterTextChanged(Editable prefix) {
		if (getFilterableArrayAdapter() != null) { 
			getFilterableArrayAdapter().getFilter().filter(prefix);
			doAfterTextChanged(prefix.toString());
		} 
	} 
	 
	public void doAfterTextChanged(String prefix) {
		// Do Nothing 
	} 
	 
	/** 
	 * @return The {@link ArrayAdapter} of the list to filter. 
	 */ 
	public abstract ArrayAdapter<T> getFilterableArrayAdapter();
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:filter
        filter.addTextChangedListener(new TextWatcher() {
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            } 
 
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                mFilter.filter(s);
            } 
 
            public void afterTextChanged(Editable s) {
            } 
        }); 
    } 
 
    private boolean resolveIntent() { 
        Intent i = getIntent();
        mData = i.getData();
 
        if(mData == null) {
            return false; 
        } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:filter
        filter.addTextChangedListener(new TextWatcher() {
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            } 
 
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                mFilter.filter(s);
            } 
 
            public void afterTextChanged(Editable s) {
            } 
        }); 
    } 
 
    private boolean resolveIntent() { 
        Intent i = getIntent();
        mData = i.getData();
 
        if(mData == null) {
            return false; 
        } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:filter
     
    protected void onSearchTextChanged() { 
        // Set the proper empty string 
 
        Filter filter = mAdapter.getFilter();
        filter.filter(getTextFilter());
    } 
 
    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
        // TODO Auto-generated method stub 
        if (keyCode == KeyEvent.KEYCODE_BACK && TextUtils.isEmpty(getTextFilter())) {
            hideSoftKeyboard(); 
            onBackPressed();
            return true; 
        } 
        return false; 
    } 
     
    /** 
     * Dismisses the soft keyboard when the list takes focus. 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:filter
	@Override 
	public boolean onQueryTextChange(String newText) {
		// TODO Auto-generated method stub 
		 
		//This line is used if you don't want to show the pop up and enable your own filter. 
		filter.filter(newText);
		//This code shows the popup view which blocks other views behind it, plus it is ugly! 
		 
//		if(TextUtils.isEmpty(newText)) 
//		{ 
//			mListView.clearTextFilter(); 
//		} 
//		else 
//		{ 
//			mListView.setFilterText(newText); 
//		} 
		return true; 
	} 
	 
	@Override 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:filter
            final int count,
            final int after) {
    } 
 
    public void afterTextChanged(final Editable s) {
        filter.filter(s);
    } 
 
    public void onItemClick( 
            final AdapterView<?> parent,
            final View clicked,
            final int position,
            final long id) {
 
        final Intent data = new Intent();
 
        if(adapter instanceof CursorAdapter) {
            data.putExtra("selection", id);
        } else { 
            data.putExtra(
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:filter
		 
	} 
 
	@Override 
	public void afterTextChanged(Editable s) {
		filter.filter(s);
	} 
 
	@Override 
	public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {
		Intent data = new Intent();
		if ( adapter instanceof CursorAdapter ) {
			data.putExtra("selection", id);
		} else { 
			data.putExtra("selection", (Serializable)parent.getItemAtPosition(position));
		} 
		setResult(RESULT_OK, data);
		finish();
	} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:filter
			} 
			@Override 
			public void onTextChanged(CharSequence arg0, int arg1, int arg2,
					int arg3) {
				Filter filter=adapter.getFilter();
				filter.filter(et.getText().toString());
			} 
		}; 
		et.addTextChangedListener(tw);
	} 
 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:filter
            performFiltering(text, start, end, keyCode);
        } else { 
            dismissDropDown();
            Filter f = getFilter();
            if (f != null) {
                f.filter(null);
            } 
        } 
    } 
 
    protected void performFiltering(CharSequence text, int start, int end,
            int keyCode) {
        getFilter().filter(text.subSequence(start, end), this);
    } 
 
    @Override 
    public void performValidation() { 
        Validator v = getValidator();
        if (v == null || mTokenizer == null) {
            return; 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android Filter Questions & Answers:

See Code Examples for Android Filter Methods: