Example usage for android.app SearchableInfo getVoiceSearchLaunchRecognizer

List of usage examples for android.app SearchableInfo getVoiceSearchLaunchRecognizer

Introduction

In this page you can find the example usage for android.app SearchableInfo getVoiceSearchLaunchRecognizer.

Prototype

public boolean getVoiceSearchLaunchRecognizer() 

Source Link

Document

Checks if voice search should start in-app search.

Usage

From source file:com.delexus.imitationzhihu.MySearchView.java

void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;//from  w  ww .ja  va 2  s. c  om
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent, searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent, searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}

From source file:cm.aptoide.com.actionbarsherlock.widget.SearchView.java

private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;/*from www  .j  av  a2s  .com*/
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent, searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent, searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}

From source file:android.support.v7.widget.SearchView.java

@TargetApi(Build.VERSION_CODES.FROYO)
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;//from w  w w.  j a v  a2  s .  c  om
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent, searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent, searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}