Android Threads Tutorial for Beginners

Threading in Android

1. Threading Components that Attach to an Activity/Fragment

2. Threading Components that Don’t Attach to an Activity/Fragment

1. Main thread:

2. UI thread:

3. Worker thread:

4. Any thread:

@Target([AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.CLASS, AnnotationTarget.FILE, AnnotationTarget.VALUE_PARAMETER]) class AnyThread
<code>
@AnyThread
public void deliverResult(D data) { ... }
</code>

5. Binder thread:

Senior Software Engineer | Android | Java | Kotlin|Xamarin Native Android|Flutter