I fill in the Linear Layout in the ScrollView buttons. I generate Id for each button and assign Tag to it. Depending on which button is pressed by the user, certain text will be displayed in the AlertDialog. Text is already defined in an array of strings. The buttons are stored in an array of buttons and each has a generated id and Tag. This is the button click handler in the activity from which you want to call AlertDialog:
View.OnClickListener oclBtn1= new View.OnClickListener() { @Override public void onClick(View v) { } };
And this is the code of the method in the activity of invoking the dialog, in which I want to determine the content of the 3-x TextView depending on the pressed button in the Activity:
public void createAndShowDialog(String title, String message1, String message2) { AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog alert = builder.create(); alert.show(); }
The question is how to implement a call to this method in oclBtn1, assign your xml markup to the created dialog and attach the input data to the method (strings) from the already created arrays, to the TextView in the xml markup?
I will be glad to any answers, since I am still quite new to Android Studio. If you see that something is implemented is not very rational, then offer your options. The array of buttons is created because in each cell there are 4 buttons, which through lnInflater in a cycle get their id and tag, and processing in oclBtn1.