0

I read about this class:

Do not instantiate this class directly, instead, call createSpeechRecognizer(Context). This class's methods must be invoked only from the main application thread.

I suppose that the main application thread is the main Activity of an Android application... Why should this class's methods be invoked only from the main application thread?

enzom83
  • 8,080
  • 10
  • 68
  • 114

1 Answers1

2

The main application thread is also known as the UI thread.

This is done to ensure thread safety. (No two processes can modify the same value at the same time).

Please see: Why can only the UI thread in Android update the UI?

Community
  • 1
  • 1
braden
  • 1,496
  • 17
  • 31