I have an array of EditTexts that I would like to get converted into an Array of Strings containing the input values of each of the EditTexts. Here is my code:
val textFields = arrayOf<EditText>(dialogView.findViewById(R.id.et_name),
dialogView.findViewById(R.id.et_address), dialogView.findViewById(R.id.et_phoneNo),
dialogView.findViewById(R.id.et_amount), dialogView.findViewById(R.id.et_remark))
How do I get a String Array of the values of the EditTexts with minimal code?
Edit: Basically I want to fit the code as an argument in a function. I would prefer to have it done without using a for-loop. Perhaps an inline function that would give out an array transforming (as given in the function block) each element (EditText) of the original one to a string. I couldn't find any method so far (although it might turn out to be something obvious).
I also need to use it as a vararg parameter.