音楽ファイルの読み込み方

31 views
Skip to first unread message

sou

unread,
Jul 18, 2022, 8:42:58 AM7/18/22
to 日本Androidの会
Intent→onActivityResultから音楽ファイルを指定。
Uri uri = data.getData();
String s =  uri.toString();
Uri uri2 = Uri.parse( s );
とした場合、
con.getContentResolver().openInputStream(uri2);
でInputStreamが返ってきます。

そこで以下が問題なのですが、
sの文字列を一旦保存して、アプリを再起動させてから、sの文字列を読み込み、
Uri uri2 = Uri.parse( s );
con.getContentResolver().openInputStream(uri2);
としてもnullになります。
何故でしょうか?また他にInputStreamを取得できる方法はありますでしょうか?

テスト環境はAPI30です。
Reply all
Reply to author
Forward
0 new messages