共享选项的蓝牙共享选项消失
Bluetooth share option disapper for sharing option
尝试共享多个音频文件时,蓝牙选项未出现在共享列表中
我正在使用下面的代码
ArrayList<Uri> pathuri = new ArrayList<Uri>();
for (int i = 0; i < path.length; i++) {
pathuri.add(i, Uri.fromFile(new File(path[i])));
}
Intent sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sendIntent.putExtra(Intent.EXTRA_STREAM, pathuri);
sendIntent.setType("audio/*");
startActivity(Intent.createChooser(sendIntent,
getString(R.string.send_via)));
以上代码在 Android 4.4 中工作正常,而 below.But 在 Android 5.0 中不工作。
并且在尝试以下代码时,蓝牙选项即将出现。但它给出了以下错误
ArrayList<Uri> pathuri = new ArrayList<Uri>();
for (int i = 0; i < path.length; i++) {
pathuri.add(i, Uri.fromFile(new File(path[i])));
}
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, pathuri);
或
sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,
pathuri);
sendIntent.setType("audio/*");
startActivity(Intent.createChooser(sendIntent,
getString(R.string.send_via)));
错误:
Key android.intent.extra.STREAM expected Parcelable but value was a java.util.ArrayList. The default value <null> was returned.
Attempt to cast generated internal exception:
java.lang.ClassCastException: java.util.ArrayList cannot be cast to android.os.Parcelable
任何人都可以帮助我解决这个问题,在此先感谢
找到上述问题的解决方案:
ArrayList<Uri> pathuri = new ArrayList<Uri>();
for (int i = 0; i < path.length; i++) {
pathuri.add(i, Uri.fromFile(new File(path[i])));
}
Intent sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,
pathuri);
sendIntent.setType("*/*"); // previously i am using sendIntent.setType("audio/*");
startActivity(Intent.createChooser(sendIntent,
getString(R.string.send_via)));
尝试共享多个音频文件时,蓝牙选项未出现在共享列表中
我正在使用下面的代码
ArrayList<Uri> pathuri = new ArrayList<Uri>();
for (int i = 0; i < path.length; i++) {
pathuri.add(i, Uri.fromFile(new File(path[i])));
}
Intent sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sendIntent.putExtra(Intent.EXTRA_STREAM, pathuri);
sendIntent.setType("audio/*");
startActivity(Intent.createChooser(sendIntent,
getString(R.string.send_via)));
以上代码在 Android 4.4 中工作正常,而 below.But 在 Android 5.0 中不工作。
并且在尝试以下代码时,蓝牙选项即将出现。但它给出了以下错误
ArrayList<Uri> pathuri = new ArrayList<Uri>();
for (int i = 0; i < path.length; i++) {
pathuri.add(i, Uri.fromFile(new File(path[i])));
}
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, pathuri);
或
sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,
pathuri);
sendIntent.setType("audio/*");
startActivity(Intent.createChooser(sendIntent,
getString(R.string.send_via)));
错误:
Key android.intent.extra.STREAM expected Parcelable but value was a java.util.ArrayList. The default value <null> was returned.
Attempt to cast generated internal exception:
java.lang.ClassCastException: java.util.ArrayList cannot be cast to android.os.Parcelable
任何人都可以帮助我解决这个问题,在此先感谢
找到上述问题的解决方案:
ArrayList<Uri> pathuri = new ArrayList<Uri>();
for (int i = 0; i < path.length; i++) {
pathuri.add(i, Uri.fromFile(new File(path[i])));
}
Intent sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,
pathuri);
sendIntent.setType("*/*"); // previously i am using sendIntent.setType("audio/*");
startActivity(Intent.createChooser(sendIntent,
getString(R.string.send_via)));