android - Mediaplayer.prepare() crash with IllegalStateException, only for Xiaomi Note 3 & Xiaomi Mi4 -


for alarm app, error coming xiaomi note 3 & xiaomi mi4 devices & working fine other devices including personsal xiaomi redmi 3s.

exception java.lang.runtimeexception: unable start activity   java.lang.illegalstateexception : caused java.lang.illegalstateexception: android.media.mediaplayer._prepare (mediaplayer.java) android.media.mediaplayer.prepare (mediaplayer.java:1408) android.app.activity.performcreate (activity.java:6912) android.app.instrumentation.callactivityoncreate (instrumentation.java:1126) android.app.activitythread.performlaunchactivity (activitythread.java:2877) android.app.activitythread.handlelaunchactivity (activitythread.java:2985) android.app.activitythread.-wrap14 (activitythread.java) android.app.activitythread$h.handlemessage (activitythread.java:1635) android.os.handler.dispatchmessage (handler.java:102) android.os.looper.loop (looper.java:154) android.app.activitythread.main (activitythread.java:6692) java.lang.reflect.method.invoke (method.java) com.android.internal.os.zygoteinit$methodandargscaller.run (zygoteinit.java:1468) com.android.internal.os.zygoteinit.main (zygoteinit.java:1358) 

let's assume provide data-source before mediaplayer.prepare()

since mediaplayer.prepare() blocks main thread, results in exception. prevent this, try mediaplayer.prepareasync() instead of mediaplayer.prepare(). apporach read onpreparedlistener() , onerrorlistener()
if didn't help, please have @ this, this , this


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -