Portal Berita dan Informasi Terbaik di Indonesia

PhotoPicker-Compose-Android 13. Android 13 (API 33) introduces a new… | by Nav Singh πŸ‡¨πŸ‡¦ | Jun, 2022

Android 13 (API 33) introduces a new tool called photo picker πŸ–Ό. Today, we will learn how to integrate this into android applications.

It provides a browsable, searchable interface that presents the user with their media library, sorted by date πŸ“†.

Note from official docs:

Upcoming Google Play system updates are expected to include new features related to the photo picker. In one such update, the library will add support for apps that target Android 11 (API level 30) or higher (excluding Android Go devices).

  • By default maximum number of media selections allowed is set to 1.

πŸ›‘ During development, I found weird behavior when defining the maximum number 1, it immediately fails with RESULT_CANCELED(0) 🀯

  • No need to worry we can modify it 😊

Provide the limit using the putExtra() method of Intent

ℹ️ There is a platform limit on the largest number that needs to be respected when we specify the maximum number of files.

  • MediaStore.getPickImagesMaxLimit() provides that limit.

The photo picker opens in half-screen mode when the maximum is set to 1

Left side (default limit 1), Right side (when the limit is more than 1)



Source by [author_name]

Leave a Reply

Your email address will not be published.