Code example for TextToSpeech

Methods: isSpeaking

0
        @SuppressWarnings("unused") 
        public int speak(String text, int queueMode, String jsonParams) {
            // Try to pull the params from the JSON string. 
            HashMap<String, String> params = null;
            try { 
                if (jsonParams != null) {
                    params = new HashMap<String, String>();
                    JSONObject json = new JSONObject(jsonParams);
 
                    // Using legacy API here. 
                    @SuppressWarnings("unchecked") 
                    Iterator<String> keyIt = json.keys();
 
                    while (keyIt.hasNext()) {
                        String key = keyIt.next();
                        // Only add parameters that are raw data types. 
                        if (json.optJSONObject(key) == null && json.optJSONArray(key) == null) {
                            params.put(key, json.getString(key));
                        } 
                    } 
                }