Here you can find the source of getTtsCurrentEngine(TextToSpeech tts)
public static String getTtsCurrentEngine(TextToSpeech tts)
/**// ww w . j ava 2 s .c o m * Copyright (C) 2012 Hyperionics Technology LLC <http://www.hyperionics.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import android.app.Application; import android.app.ProgressDialog; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.AsyncTask; import android.os.Build; import android.speech.tts.TextToSpeech; import android.view.accessibility.AccessibilityManager; import java.io.*; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; public class Main{ public static String getTtsCurrentEngine(TextToSpeech tts) { // returns TTS engine of the tts object passed, not the default system engine! if (tts != null) { final Class<?> ttsClass = tts.getClass(); try { final Method method = ttsClass .getMethod("getCurrentEngine"); String engName = (String) method.invoke(tts, (Object[]) null); return engName != null ? engName : ""; } catch (Exception e) { } try { Field f = ttsClass.getDeclaredField("mCachedParams"); // Found in Android 2.3... f.setAccessible(true); String[] ss = (String[]) f.get(tts); for (int i = 0; i < ss.length - 1; i++) { if (ss[i].equals("engine")) return ss[i + 1]; } } catch (Exception e) { Lt.d("Exception " + e); } } return ""; } }