'Is there a way to display multiple bottom sheet dialogs and get the information from each one?

I created a bottom sheet dialog and I want to display it every time the user press on a specific object on the app, I have a few 'specific' objects and I want to display the same bottom sheet design but its actually not the same sheet. What I did is I created an array of BottomSheetDialog and I thought it will work just fine but as I progressed I realized I don't have access to each editText of the individual dialogs in the array- I have few editTexts in each dialog, so for example if I have 3 dialogs I can't just use findviewbyid() and get the editText by its id because I have a few editText from the same id (1 in each dialog).

Is there a way to access the editTexts of each dialog in the array?

what I did so far:

 public boolean onMarkerClick(@NonNull Marker marker) {
        if (isFinished){
            if (bottomSheetDialogArray[markedPoints.indexOf(marker)] == null){
                bottomSheetDialogArray[markedPoints.indexOf(marker)] = new BottomSheetDialog(this,R.style.BottomSheetDialogTheme);
            }
            View bottomSheetView = LayoutInflater.from(getApplicationContext()).inflate(
                    R.layout.layout_bottom_sheet,
                    findViewById(R.id.bottomSheetContainer)
            );
            bottomSheetDialogArray[markedPoints.indexOf(marker)].setContentView(bottomSheetView);
            bottomSheetDialogArray[markedPoints.indexOf(marker)].show();
        }
        return false;
    }

Here I managed to display each dialog individually but now I need a way to access its attributes (like editTexts)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source