I have a Mediametadatareview
, but when I use setDataSource()
gets out, I notice the error is due to a file with the name /storage/sdcard/NhạcCuảTôi.mp3
(The file name is Vietnamese). How to change that file to a true URI?
this is my code
mediaMetadataRetriever = new MediaMetadataRetriever();
Uri u = Uri.parse(filedata);
mediaMetadataRetriever.setDataSource(MainAC.this, u);
String gene= mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE);
it crashed at mediaMetadataRetriever.setDataSource(MainAC.this, u);
I think the error is because the file name has an accent, is there any way to help convert the string to URI and unmark? Because if I delete the file with that sign then the application works normally
this is LOGCAT :
java.lang.RuntimeException: Unable to start activity ComponentInfo{dragonrocky.music/dragonrocky.music.MainAC}: java.lang.RuntimeException: setDataSource failed: status = 0x80000000
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2505)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.access$1000(ActivityThread.java:164)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1462)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:5541)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
Caused by: java.lang.RuntimeException: setDataSource failed: status = 0x80000000
at android.media.MediaMetadataRetriever.setDataSource(Native Method)
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:71)
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:165)
at dragonrocky.music.MainAC.loadAudio(MainAC.java:519)
at dragonrocky.music.MainAC.onCreate(MainAC.java:156)
at android.app.Activity.performCreate(Activity.java:6093)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2458)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.access$1000(ActivityThread.java:164)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1462)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:5541)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
Thank You.