Code: Select all
public static void ChooseVideo(ActivityResultLauncher resultLauncher) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && SdkExtensions.getExtensionVersion(Build.VERSION_CODES.R) >= 2) {
Intent intent = new Intent(MediaStore.ACTION_PICK_IMAGES);
intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[]{"video/*"});
resultLauncher.launch(intent);
}else {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("video/*");
resultLauncher.launch(intent);
}
Log.i("FilesUtil", "loading video");
}
Code: Select all
Intent intent = new Intent(MediaStore.ACTION_PICK_IMAGES);
intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[]{"video/*"});
resultLauncher.launch(intent);
Android 13-Bild
Es funktioniert korrekt auf Android 13 AVD und echten Geräten mit Android 13 und höher.
Das Problem ist, dass es auf Android 14 und 15 im Android Studio AVD nicht funktioniert .es werden keine Medien angezeigt Wählen Sie:
Android 14 und 15 AVD-Bild
Es funktioniert gut auf echten Geräten, aber nicht in AVDIch habe diese Versionen ausprobiert
AVD ver image