Answer the question
In order to leave comments, you need to log in
Splitting words in editText?
How can I take the part of the editText up to the space and save it to a variable? I did this:
EditText namm;
String data = editText2.getText().toString();
for(i=0; i != data.length(); i++) {if (String.valueOf(data.charAt(i)) == " ") { namm = editText2.setSelection(z, i-1);
z = i;
values put("nam", namm);
values put("sv", "4");
db.insert("QW", "nam", values); }
}
But writes incompatibility of types.
Answer the question
In order to leave comments, you need to log in
String data = editText2.getText().toString();
String[] words = data.split(" ");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question