Here you can find the source of isSpeechRecognitionActivityPresented( Activity callerActivity)
private static boolean isSpeechRecognitionActivityPresented( Activity callerActivity)
//package com.java2s; import java.util.List; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.speech.RecognizerIntent; public class Main { private static boolean isSpeechRecognitionActivityPresented( Activity callerActivity) {// w ww .j av a 2 s.co m try { // getting an instance of package manager PackageManager pm = callerActivity.getPackageManager(); // a list of activities, which can process speech recognition Intent List<ResolveInfo> activities = pm .queryIntentActivities(new Intent( RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0); if (activities.size() != 0) { // if list not empty return true; // then we can recognize the speech } } catch (Exception e) { } return false; // we have no activities to recognize the speech } }