簡體   English   中英

如果Uri指向使用FileExplorer重命名的文件,則MediaPlayer.create(Context,Uri)返回null

[英]MediaPlayer.create(Context, Uri) returns null, if Uri points to a file which has been renamed using FileExplorer

MediaPlayer.create(Context, Uri)返回null。 我使用FileExplorer應用程序更改某個文件的路徑,然后Uri指向該文件。 Uri是完全正確的。 但是,我從這個方法得到null而不是MediaPlayer對象。 有幫助嗎?

我在過去遇到過這個問題。重命名該文件后,只需檢查該文件是否可以從您的應用程序外部打開。

我敢肯定,該文件無法打開。

因此,只需放置一個空檢查並向用戶顯示Toast。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM