F
F
flm2011-07-11 14:06:50
Android
flm, 2011-07-11 14:06:50

Android, open image from given folder

Help with a universal solution.
From the drawing application, you need to open an image from a specified folder (the folder was created on cdcard when installing the application). Naturally, I want to show previews of the available images in the folder for selection.
It seems to be a convenient solution using Intent with Intent.ACTION_PICK: But this solution only works on the emulator, the entire sdcard opens on the phone. If you change Intent.ACTION_PICK to Intent.ACTION_VIEW - then this code works as expected - it gives only the specified folder for viewing. Tell me what could be the problem. Or suggest another solution to the problem. Thank you.

String bucketName = "/sdcard/PaintUp/sketches";
bucketName = Integer.toString(bucketName.toLowerCase().hashCode());
Uri uri = Images.Media.INTERNAL_CONTENT_URI.buildUpon().appendQueryParameter("bucketId", bucketName).build();
Intent intent = getIntent().setData(uri).setAction(Intent.ACTION_PICK);
startActivityForResult(Intent.createChooser(intent, "Choose a Viewer"), PICK_SKETCH_ACTIVITY);




Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question