Reputation: 54783
I'm pretty new to Android development.
Is it possible to remove the two buttons (Always / Only Once) when opening an Intent.ACTION_GET_CONTENT
?
Here is my current code.
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent,PICK);
Upvotes: 7
Views: 3107
Reputation: 901
The key is to create an Intent.createChooser()
, if you call Intent.createChooser()
, passing it your Intent object, it returns a version of your intent that will always display the chooser.
Example:
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my awesome text to share.");
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Share via"));
Upvotes: 0
Reputation: 54783
I found a way to achieve this :
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
Intent openInChooser = Intent.createChooser(intent, "Open in...");
startActivityForResult(openInChooser,PICK);
Upvotes: 13
Reputation: 82543
That is a system generated dialog, so you cannot alter it.
You could use queryIntentActivities()
to get a list of the apps which can respond to your intent, and then show them in your own dialog without the buttons if you like.
Upvotes: 0