Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

@UiThread isn't always on the UI thread #693

@GingerMcMurray

Description

@GingerMcMurray

If an instance of an annotated class is created on a thread other than the UI thread, the handler which gets created does not get associated with the UI thread. The generated code is:

private Handler handler_ = new Handler();

This is creating a handler which is tied to the current thread.

According to the docs and a few StackOverflow questions, if it's created like this it'll be guaranteed to be connected to the UI thread:

private Handler handler_ = new Handler(Looper.getMainLooper());

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions