没有从数组中取正确的值

Kur*_*urt 0 java arrays android arraylist settext

我想定义一个包含一堆字符串的数组.

然后我希望能够在数组中引用不同的字符串.听起来很简单,但是使用下面的代码,我将为变量onOneClick返回"to be"(即数组中的第二个字符串)(应该引用第一个字符串或"to implicate").

有任何想法吗?

String hintsList[] = {"to implicate", "to be", "to bite", "to draw", "to run", "to go", "to escape", "to fall", "to accept", "to open", "to laugh", "to listen", "to open", "to dance", "to use", "to save (not waste)", "to create"};

final String onOneClick = hintsList[1];
final EditText box0101 = (EditText)findViewById(R.id.box0101);

        box0101.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            txtHint.setText(onOneClick);                
        }
    });
Run Code Online (Sandbox Code Playgroud)

Ale*_*lex 7

数组从零开始索引.如果你想要第一个元素,请使用hintsList[0]