Example usage for android.webkit WebView clearMatches

List of usage examples for android.webkit WebView clearMatches

Introduction

In this page you can find the example usage for android.webkit WebView clearMatches.

Prototype

public void clearMatches() 

Source Link

Document

Clears the highlighting surrounding text matches created by #findAllAsync .

Usage

From source file:com.ywesee.amiko.MainActivity.java

@TargetApi(16)
void setFindListener(final WebView webView) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        webView.setFindListener(new FindListener() {
            @Override/*from  w w  w .  j av a 2  s. co  m*/
            public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches,
                    boolean isDoneCounting) {
                // Update hits counter
                if (isDoneCounting) {
                    if (activeMatchOrdinal < numberOfMatches) {
                        mSearchHitsCntView.setVisibility(View.VISIBLE);
                        mSearchHitsCntView.setText((activeMatchOrdinal + 1) + "/" + numberOfMatches);
                    } else {
                        mSearchHitsCntView.setVisibility(View.GONE);
                        webView.clearMatches();
                    }
                }
            }
        });
    }
}