I can create a chooser with following code:
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_TEXT, "hello");
startActivity(Intent.createChooser(share, "my title"));
I want to send (suppose) this “hello” but I want to specify what should appear in activity that starts with this call startActivity(Intent.createChooser(share, "my title")); , its showing all the apps which are installed in my phone. Can’t I limit it to few applications only?
When you do this, all the apps that can receive your intent are shown to the user, so he can select the one he prefers to perform the specified action. No, you cannot limit this to only a few applications.
You can call a certain app directly, however, if you know it’s activity name. In this case, ignore the chooser and create your own dialog box with a list view with the names of the apps that you want. When a user selects one of these, then fire an intent to only that specific app.
Make sure you check if the user has the app in the first place though. You can do this by querying the package manager for all the broadcast receivers that receive a certain type of broadcast (ex:text broadcasts). You can do this using:
public abstract List queryBroadcastReceivers (Intent intent, int flags)
Developer docs for this are here:
https://developer.android.com/reference/android/content/pm/PackageManager.html#queryBroadcastReceivers%28android.content.Intent,%20int%29