Bottom Sheet Dialog Fragment Using Kotlin

Bottom Sheet Dialog Fragment, is a view that slides from the bottom of a screen to show extra content. In this tutorial we shall be using bottom sheet dialog fragment to display edit text that requires username.

BottomSheetDialogFragment is a class that is provided by default, You will need to create a java class that extends bottom sheet dialog fragment.

In your class override method oncreate, Inside that method you will need to inflate your layout.

Find the views in your layout by calling findview by id.

Here is what our Bottom Sheet Dialog Fragment will contain.

The Bottom Sheet Dialog in this tutorial will contain two elements, Edit Text and Button.

The Edit Text is where users will input Username and Button will Open new Activity when clicked.

If user clicked on continue button within the bottom sheet dialog without providing username a toast with message as inputs required is show.

If user provides username and clicks the continue but a new activity open which contains a TextView to display the the username.

Hence we also learn how to pass data from a fragement to activity.

GridView with CardView:

Get more from android documentation:

If you watch the above video and need additional help, Kindly comment below.

For source code, You can get it for only $5 to support the work.