它适用于3-4个文件,但之后就开始崩溃了。
这是代码 -
fileName = list.get(position);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
File file1 = new File(file.getAbsolutePath() + "/" + fileName);
intent.setDataAndType(Uri.fromFile(file1), "audio/*");
startActivity(intent);
记录 -
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///storage/emulated/0/Android/data/appname/files/DCIM/.foldername/+33535_25.mp3 typ=audio/* }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1765)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1602)
at android.app.Activity.startActivityFromFragment(Activity.java:4340)
at android.app.Activity.startActivityFromFragment(Activity.java:4312)
at android.app.Fragment.startActivity(Fragment.java:1075)
at android.app.Fragment.startActivity(Fragment.java:1054)