diff --git a/android/src/main/java/com/getcapacitor/community/speechrecognition/SpeechRecognition.java b/android/src/main/java/com/getcapacitor/community/speechrecognition/SpeechRecognition.java index fa63ebd..e60458b 100644 --- a/android/src/main/java/com/getcapacitor/community/speechrecognition/SpeechRecognition.java +++ b/android/src/main/java/com/getcapacitor/community/speechrecognition/SpeechRecognition.java @@ -44,14 +44,11 @@ public void load() { bridge .getWebView() .post( - new Runnable() { - @Override - public void run() { - speechRecognizer = SpeechRecognizer.createSpeechRecognizer(bridge.getActivity()); - SpeechRecognitionListener listener = new SpeechRecognitionListener(); - speechRecognizer.setRecognitionListener(listener); - Logger.info(getLogTag(), "Instantiated SpeechRecognizer in load()"); - } + () -> { + speechRecognizer = SpeechRecognizer.createSpeechRecognizer(bridge.getActivity()); + SpeechRecognitionListener listener = new SpeechRecognitionListener(); + speechRecognizer.setRecognitionListener(listener); + Logger.info(getLogTag(), "Instantiated SpeechRecognizer in load()"); } ); }