Skip to content

"The application may be doing too much work on its main thread" #4

@hammmmy

Description

@hammmmy

just a minor issue but I got the following logcat message while running on a raspberry pi 3
com.example.androidthings.gattserver I/Choreographer: Skipped 86 frames! The application may be doing too much work on its main thread.
wouldn't it be better to move the UI code mLocalTimeView.setText(displayDate); to another thread e.g. a runnable inside a runOnUiThread?
e.g.

    private void updateLocalUi(long timestamp) {
        Date date = new Date(timestamp);
        final String displayDate = DateFormat.getMediumDateFormat(this).format(date)
                + "\n"
                + DateFormat.getTimeFormat(this).format(date);
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                mLocalTimeView.setText(displayDate);
            }
        });
    }

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