Is there a native platform-independent solution for asynchronous tasks? For example, on a PC this is SwingWorker , on Android it is AsyncTask .
Update 0
The question was frozen due to incomprehensibility; I apologize for the curved syllable, now I will try to explain: Help, please, find a cross-platform analogue of AsyncTask Android'ovskih, so that there are methods onPreExecute , doInBackground , onPostExecute and that this analogue works equally on Windows / Linux and Android . Searched in google - found all sorts of SwingWorker , but they depend on the platform. I tried to transfer the source AsyncTask , but there is also a link to the platform because of the Handler classes and the like.
Whether this analogue of AsyncTask 'a is in the form of a library or an embedded solution does not matter.
Update 1
OK, as a result of brainstorming the task is now even more simplified. We need a cross-platform method to call a method from another thread within the UI (main) stream. That is, for example, when the program is started, the interface is loaded and some kind of animation takes place, and work with the network begins in another thread. After working with the network, you need to run the method in the UI stream, for example, to change the text on the button. How can this be correctly implemented with one code so that it works on both PCs and Android?
Future<T>and everything around it does not suit you? - VladD