Reputation: 3423
Is there a built-in way for a grid bottom sheet, usually seen for sharing in some apps, or do I have to create a custom BottomSheet?
//1 column bottom sheet
String message = "Text I want to share.";
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_TEXT, message);
startActivity(Intent.createChooser(share, "Share through:"));
Upvotes: 0
Views: 129
Reputation: 2294
The intent chooser is a property of the OS and you can't really change it. As you might have noticed, this chooser has changed its appearance in the different releases of the OS. The apps in which you have seen a grid chooser might have implemented a custom bottom sheet or activity to look like a bottom sheet. You can achieve this by using the Android PackageManager. You can obtain the different apps that can handle your intent and show these in your custom chooser and then send the intent to the app which the user clicks on.
Upvotes: 2