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

java.lang.RuntimeException: this should be called in Main Thread at #103

Open
yoonusc opened this issue Dec 17, 2018 · 3 comments
Open

java.lang.RuntimeException: this should be called in Main Thread at #103

yoonusc opened this issue Dec 17, 2018 · 3 comments

Comments

@yoonusc
Copy link

yoonusc commented Dec 17, 2018

Process: com.volokh.danylo.videolist, PID: 32200
java.lang.RuntimeException: this should be called in Main Thread
at com.volokh.danylo.video_player_manager.ui.MediaPlayerWrapper.onVideoSizeChanged(MediaPlayerWrapper.java:214)
at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:4701)
at android.os.Handler.dispatchMessage(Handler.java:106)

@prasad456
Copy link

same issue @yoonusc do you have any fix or any other alternate?

@fangood
Copy link

fangood commented Aug 5, 2019

I have same issue:
Process: com.qk365.thweeks, PID: 15108
java.lang.RuntimeException: this should be called in Main Thread
at com.volokh.danylo.video_player_manager.ui.MediaPlayerWrapper.onVideoSizeChanged(MediaPlayerWrapper.java:214)
at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3402)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6701)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:249)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)

change this:
MediaPlayerWrapper
private boolean inUiThread() {
// return Thread.currentThread().getId() == 1;
return Thread.currentThread() == Looper.getMainLooper().getThread();
}

@ghost
Copy link

ghost commented Aug 14, 2019

Change the method inUiThread() to the below code.

private boolean inUiThread() {
return Looper.myLooper() == Looper.getMainLooper();
}

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

3 participants