Skip to content

handleIntent() performs blocking I/O on main thread in onCreate() #2151

@nbd-boss

Description

@nbd-boss

In LoadActivity.onCreate(), handleIntent(intent) is invoked on the main (UI) thread.
However, handleIntent() performs multiple blocking I/O operations, including:
getContentFromURI()InputStream.read() on content URIs
extractPreferencesFromUri()FileInputStream, BufferedReader.readLine()

Because all of these operations are performed synchronously on the UI thread, they can cause:
noticeable UI freezes
ANR when loading large config files
degraded user experience during app startup

Why this is a problem
Android guidelines recommend moving any file I/O off the main thread.
Running these in onCreate() further increases the risk of UI jank.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions