我正在尝试使用带有Case Insensitive的搜索来获取领域控制器中的所有值,但是当db中有两个值“Animal,ant”时,当我搜索时,只显示一个ant。我已经添加了Case.INSENSITIVE但它无法正常工作
package com.example.frank.listview_test;
import android.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public static class TestListFragment extends Fragment {
private String[] myStringArray = new String[20];
private ListView listView;
private void setArray() {
for (int i = 0; i < 10; i++) {
this.myStringArray[i] = "hello";
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
setArray();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),R.layout.list_item , myStringArray);
listView = (ListView) getActivity().findViewById(R.id.testListView);
listView.setAdapter(adapter);
// Inflate the layout for this fragment
return inflater.inflate(R.layout.list_fragment, container, false);
}
}
}
这是return realm.where(Contact.class)
.contains("name",searchString, Case.INSENSITIVE)
.findAllSorted("name");
类:
Contact
P.S使用io.realm:realm-gradle-plugin:1.1.0