Executing native background work on Java threads
In previous sections, we used the JNI interface to execute native functions on the main thread. Since they run on the main thread, the functions were able to update the UI, access the Activity
instance fields, and or update any UI widget directly.
However, as we discussed before, for long computing or intensive tasks we have to execute them on the background thread.
In previous sections, we learned how to use the AsyncTask, Loader
, Handler
, and Remote Services to execute work on background threads that don't reduce the UI responsiveness or interfere with UI rendering.
In any of these Android specific constructs, the background thread is already attached to the JVM. Hence, the background thread already ...
Get Asynchronous Android Programming - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.