There's a way around you can create your own chooser that asks you to pick an activity without asking if you always want to use it.
This task can be acheived using 'Intent.createChooser()'.
Intent.createChooser() allows you to specify a title for the chooser dialog, and doesn’t give the user the option of selecting an activity to use by default. It also lets the user know if there are no matching activities by displaying a message.
Syntax:
Intent chosenIntent = Intent.createChooser(intent, "Send message...");
intent is the original Intent that we have made which describe the types of activity you want the chooser to display.
"Send message..." here specifies the title of the activity chooser.
The createChooser() method returns a brand-new Intent.
What happens in the background:
1) The createChooser() method gets called.
The method includes an intent that specifies the action and MIME type that’s required.
2)Android create a chooser for activities that support.It matches on the actions, type of data and categories they can support.
3)Android lets the user to select the activity but this time it doesn’t give the user the option of always using a particular activity.
Also when no activity are found corresponding to that intent action it doesn't throw any exception rather it displays a message telling that there are no apps that can perform the action.
4)When the user chooses which activity she wants to use, Android returns a new explicit intent describing the chosen activity. The new intent includes any extra information that was included in the original intent, such as any extra text.
5)The activity asks Android to start the activity specified in the intent.
6)Android asks the activity specified by the intent to start, and then passes it the intent.

Comments
Post a Comment