How in android to handle events in the background?

Just starting to look into Android, and do not understand how to do some functions in the background, such as by pressing a button, but constantly.
For example once a second to change color.
Now done via a thread, but perhaps there is an easier way?
April 4th 20 at 13:20
3 answers
April 4th 20 at 13:22
Solution
For a case like in the example, IMHO it is better suited to a whole variety of tools
https://developer.android.com/reference/java/util/Timer
example
www.cyberforum.ru/post7226218.html
I have implemented tabs in TabLayout.
And the data is processed through the PlaceholderFragment, and this method should be declared in onCreate, and will fail with an error. - augustine_Powlowski91 commented on April 4th 20 at 13:25
Brrr . This is a new issue ? Or you originally asked is not what you need really. - craig.Gutkowski99 commented on April 4th 20 at 13:28
April 4th 20 at 13:24
Solution
Read about the AsyncTask. You can also use a separate thread and Hadler. Here's a quick video lesson on this topic.
April 4th 20 at 13:26
Look at RxJava

Find more questions by tags JavaAndroid