2

When I am trying to invoke implicit intent with action "Intent.ACTION_GET_CONTENT", I am getting this error alert "No apps can perform this action." Thanks in advance. Please see my code below.

 Intent intent = new Intent();
 intent.setType("*/*");
 intent.setAction(Intent.ACTION_GET_CONTENT);
 startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
Dhruvi
  • 1,971
  • 2
  • 10
  • 18

3 Answers3

3

Problem coming from setType section .

This is used to create intents that only specify a type and not data, for example to indicate the type of data to return.

Don't

intent.setType("*/*"); // Arise problem

Do

 intent.setType("image/*"); 

EDITED

You can try with

Intent intent_open = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent_open.setType("image/* video/*");
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
1

try this

Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("video/*, images/*");
startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
1

You need to set an explicit MIME data type to intent. For example

  Intent intent=new Intent(Intent.ACTION_PICK);
    intent.setType("image/*"); //for image pick from gallery via intent
    intent.setType("video/*"); //for video pick from gallery via intent
Mohammed Farhan
  • 1,120
  • 8
  • 14