Skip to content

Conversation

@upender-reddy
Copy link

@upender-reddy upender-reddy commented Apr 15, 2020

App was crashing with RuntimeException("this should be called in Main Thread")
due to method "inUiThread" returning false even though it is running in main thread .
After changing logic to check the main thread app is working fine.

private boolean inUiThread() {
return Thread.currentThread().getId() == 1;
// return Thread.currentThread().getId() == 1;
return Looper.myLooper() == Looper.getMainLooper()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @upender-reddy forgot to add semicolon as it's .java file.

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

Successfully merging this pull request may close these issues.

2 participants