mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-01-24 14:58:07 -05:00
Merge pull request #1116 from pfaffenrodt/feature/pick-image-file
Add support to pick image from content provider
This commit is contained in:
@@ -228,8 +228,13 @@ public class ScanActivity extends CatimaAppCompatActivity {
|
||||
public void addFromImage(View view) {
|
||||
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
|
||||
photoPickerIntent.setType("image/*");
|
||||
Intent contentIntent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
contentIntent.setType("image/*");
|
||||
|
||||
Intent chooserIntent = Intent.createChooser(photoPickerIntent, getString(R.string.addFromImage));
|
||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { contentIntent });
|
||||
try {
|
||||
photoPickerLauncher.launch(photoPickerIntent);
|
||||
photoPickerLauncher.launch(chooserIntent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Toast.makeText(getApplicationContext(), R.string.failedLaunchingPhotoPicker, Toast.LENGTH_LONG).show();
|
||||
Log.e(TAG, "No activity found to handle intent", e);
|
||||
|
||||
Reference in New Issue
Block a user