Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hammmmy opened this issue Apr 8, 2017 · 0 comments
Open

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

hammmmy opened this issue Apr 8, 2017 · 0 comments

Comments

@hammmmy
Copy link

hammmmy commented Apr 8, 2017

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);
            }
        });
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant