I select text syntax in Android Studio, for this I need a timer that will call the syntax check method every 5 seconds, in turn, this method gets the EditText itself and processes it. Tried through ScheduledExecutorService , but for some reason the program freezes during the execution of the method. Here is the code, as I did in a separate thread:
class synLight implements Runnable { private EditText editText; public synLight(EditText editText){ this.editText = editText; } @Override public void run() throws RuntimeException{ MainActivity.editText.setTextColor(Color.RED); } }