gpt4 book ai didi

android - Intent.ACTION_PICK 崩溃,类型为 "audio/*"

转载 作者:搜寻专家 更新时间:2023-11-01 08:50:39 25 4
gpt4 key购买 nike

代码:

 Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("audio/*");

startActivityForResult(intent, 1);

结果:

E/AndroidRuntime﹕ FATAL EXCEPTION: main
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.PICK typ=audio/* }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1638)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1510)
at android.app.Activity.startActivityForResult(Activity.java:3258)
at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:854)
at android.support.v4.app.Fragment.startActivityForResult(Fragment.java:889)
at org.test.sample.TestFragment.onClick(TestFragment.java:58)
at android.view.View.performClick(View.java:3538)
at android.view.View$PerformClick.run(View.java:14330)
at android.os.Handler.handleCallback(Handler.java:608)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:4977)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

"video/*""image/*" 类型可以正常工作。

现在我正在使用的音频:

new Intent(Intent.ACTION_PICK, droid.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);

最佳答案

Intent intent = new Intent();
intent.setType("audio/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Audio "), GALLERY_AUDIO);

关于android - Intent.ACTION_PICK 崩溃,类型为 "audio/*",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23777501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com