我有一些String Array
(如下所示),我想在里面搜索。我创建了一个editText
和一个Button
。进行此搜索的最佳方法是什么?
a0[0]="one";
a0[1]="two";
[...]
a1[0]="one-zero";
a1[1]="one-one";
[...]
a2[0]="two-zero";
a2[1]="two-one";
EditText searchField = (EditText) findViewById(R.id.searchfield);
Button searchButton = (Button) findViewById(R.id.searchbutton);
searchButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
for (String s : Facts_Array) {
if (searchField.getText().toString().contains(s)) {
[...]