I would like to create a small app, and in the app I have the user entering text in an editText. I already know the basics of editText, like how to get the text from it and enter it into a separate string variable. But after I have that string variable, how can I grab each letter of this message separately? I would assume that you need a For loop. Does anyone know of any easy way to do this?
Yes, use can use a For loop like this:
String MyEditText = myEditText.getText().toString();
int len = MyEditText.length();
char chars[] = MyEditText.toCharArray();
for(int i=0;i<len;i++){
//retrieve chars
char newChar = chars[i];
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments