Answer the question
In order to leave comments, you need to log in
How to pass a string from a form to an array of strings?
Can you please tell me how to pass the string from the form to string-array, which is located in values/strings.xml?
submitButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
name = nameInput.getText().toString();
firstName = firstNameText.getText().toString();
lastName = lastNameText.getText().toString();
}
});
}
<string-array name="info">
<item></item>
<item></item>
<item></item>
</string-array>
Answer the question
In order to leave comments, you need to log in
And why do you need to pass a string from a form to an xml file?
Also note that if your fields are called
name
firstName
lastName
then most likely you can create an object from it. For example, (pseudocode)
User {
String name
String firstName;
String lastName;
}
List<User> users = new ArrayList();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question