0

How can I disable spell check on all TextView's/EditText's.

I want to do this as when you call setText() on a text view it will eventually call the spell checker service which creates an async task. In my application this causes a bug where the volume of edittexts that call setText can create so many tasks for the thread pool I end up getting an RejectedExecutionException.

06-25 09:26:14.442: E/Forms(10981): java.util.concurrent.RejectedExecutionException: Task android.widget.TextView$3@3a7e75dd rejected from java.util.concurrent.ThreadPoolExecutor@257f6244[Running, pool size = 5, active threads = 5, queued tasks = 128, completed tasks = 6382]
06-25 09:26:14.442: E/Forms(10981):     at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2011)
06-25 09:26:14.442: E/Forms(10981):     at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:793)
06-25 09:26:14.442: E/Forms(10981):     at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339)
06-25 09:26:14.442: E/Forms(10981):     at android.os.AsyncTask.execute(AsyncTask.java:608)
06-25 09:26:14.442: E/Forms(10981):     at android.widget.TextView.updateTextServicesLocaleAsync(TextView.java:8344)
06-25 09:26:14.442: E/Forms(10981):     at android.widget.TextView.getTextServicesLocale(TextView.java:8300)
06-25 09:26:14.442: E/Forms(10981):     at android.widget.TextView.getSpellCheckerLocale(TextView.java:8337)
06-25 09:26:14.442: E/Forms(10981):     at android.widget.SpellChecker.spellCheck(SpellChecker.java:220)
06-25 09:26:14.442: E/Forms(10981):     at android.widget.Editor.updateSpellCheckSpans(Editor.java:541)

I can't just surround any setText()s in a try catch block as the SpellCheckerService is called in other places as well eg. when a view is added to a view group.

Tim
  • 41,901
  • 18
  • 127
  • 145
tomandro
  • 185
  • 1
  • 11

0 Answers0