Nik
Nik

Reputation: 638

Open default gallery only

I want to select files i.e images, video ..from the default gallery but when i open gallery using following function its also gives me some unnecessary option for file selection like "File Manager, OI file Manager". Those application are installed on my phone and i dont want those application when i open and select media files.

plz help

Intent intent = new Intent(Intent.ACTION_PICK);
      intent.setType("video/*, images/*");
     intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
      intent.setAction(Intent.ACTION_GET_CONTENT);
       tartActivityForResult(Intent.createChooser(intent, "Select File"),
                        REQUEST_CODE);

Upvotes: 2

Views: 1401

Answers (2)

Rishi Gautam
Rishi Gautam

Reputation: 1938

public void openGallery(int SELECT_FILE1) {

    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(
            Intent.createChooser(intent, "Select file to upload "),
            SELECT_FILE1);

}

    // gallery................//
protected void onActivityResult(int requestCode, int resultCode,
        Intent imageReturnedIntent) {
    super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
    Uri selectedImageUri = null;
    String filePath = null;
    switch (requestCode) {
    case SELECT_FILE1:
        if (resultCode == Activity.RESULT_OK) {
            selectedImage = imageReturnedIntent.getData();

            if (requestCode == SELECT_FILE1) {
                selectedPath1 = getPath(selectedImage);
                //mimagepath.setText(selectedPath1);


            if (selectedPath1 != null) {












            }


            }
        }

        break;


    }

}

Upvotes: 0

Adesh Atole
Adesh Atole

Reputation: 762

Use this

Intent intentGallery = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intentGallery, 1);

Upvotes: 1

Related Questions