-5
String
配列の単語を1つずつ返したいと思います。returnステートメントを使用して文字列配列からすべての単語を取得するには
public String CurrentString(int move) {
int currentString = 0;
EditText ed = (EditText) findViewById(R.id.ed);
String[] strings = ed.getText().toString().split(" ");
int newString = currentString move;
if (newString >= strings.length) {
// if the new position is past the end of the array, go back to the beginning
newString = 0;
}
if (newString < 0) {
// if the new position is before the beginning, loop to the end
newString = strings.length - 1;
}
currentString = newString;
Toast.makeText(getApplicationContext(), strings[currentString],Toast.LENGTH_LONG).show();
return strings[currentString];
}
問題は、上記のコードがすべてのテキストを返さないということです。助けてください。
コードが何か他のものであるため、あなたの質問を理解することは本当に難しいです、それを修正してくださいまた、いくつかのバグがあなたのコードである** currentString;。!!** ?? –
はStringTokenizerは見て考えてみましょう – JoxTraex
「のdoesn。すべてのテキストを返しません "...うーん、配列から1つの要素を返す –