Example usage for android.app SearchableInfo getVoiceSearchLaunchWebSearch

List of usage examples for android.app SearchableInfo getVoiceSearchLaunchWebSearch

Introduction

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

Prototype

public boolean getVoiceSearchLaunchWebSearch() 

Source Link

Document

Checks if voice search should start web search.

Usage

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

void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;/*  ww  w. j a v 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:cm.aptoide.com.actionbarsherlock.widget.SearchView.java

private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;/*from w  ww  .j  ava  2  s .c  o m*/
    }
    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;/* w  ww  .  j  av  a 2  s .  c  o m*/
    }
    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");
    }
}