Parthiban M
Parthiban M

Reputation: 1104

Image Upload in Android

I'm trying to upload an image to my application. I'm using the following lines to achieve this.

Intent intent = new Intent(Intent.ACTION_PICK);
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(Intent.createChooser(intent, "Select Picture"),
            PICK_IMAGE);

But when opening gallery it shows me many folders such as "Recent Images", "Documents", "Google Drive" etc.,

Here instead showing like this I would like to show only the gallery folder. Can you please help me how I can achieve this?

Upvotes: 0

Views: 73

Answers (1)

Gopal Singh
Gopal Singh

Reputation: 1133

Try this

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
startActivityForResult(Intent.createChooser(intent, "Select Picture"),
        PICK_IMAGE);

Upvotes: 1

Related Questions