How To Jumble A Word From Edittext And Apply The Jumbled Word Into A Textview
I need to know how to jumble a word entered into EditText. The jumbled word will show in another TextView in the same interface. I have tried to do this but I get a force close e
Solution 1:
You made some mistakes.
Try changing the code to:
link5Btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
jumbleMe(wordE.getText().toString());
}
});
and
privatevoidjumbleMe(String word) {
ArrayList<Character> al = newArrayList<Character>();
for (int i = 0; i < wordE.length(); i++) {
al.add(word.charAt(i));
}
Collections.shuffle(al);
String result = "";
for (Character character : al) {
result += character;
}
jumble.setText(result);
}
Post a Comment for "How To Jumble A Word From Edittext And Apply The Jumbled Word Into A Textview"