안드로이드 시스템의 공유 기능을 사용하세요.
다중 비디오 공유:
private void showShare() {
List<AlbumData> albumDataList = mAlbumListViewModel.getCheckedDataList().getValue();
if (albumDataList == null || albumDataList.isEmpty()) {
return;
}
List<Uri> videoUris =
albumDataList.stream().map(AlbumData::getUri).collect(Collectors.toList());
Intent shareIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, new ArrayList<>(videoUris));
shareIntent.setType("video/*");
requireContext().startActivity(Intent.createChooser(shareIntent, ""));
}
단일 비디오 공유:
public void share(AlbumData albumData) {
if (albumData == null || albumData.getUri() == null) {
return;
}
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, albumData.getUri());
shareIntent.setType("video/*");
requireContext().startActivity(Intent.createChooser(shareIntent, ""));
}