1) The code below : getView does not get called when I type in autocompletetextview. Watch out the list in the fragment and the adapter class extending List
public class SigninFragment extends Fragment {
private List<Test> list= null;
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Test tes= new Test ();
tes.setId(1);
tes.setDesc("descabc");
list= new ArrayList<>();
list.add(prof);
tesListAdapter =
new TesListAdapter(
rootView.getContext()
,R.layout.list_row_adapter
,list);
autocompletetextview.setThreshold(3);
autocompletetextview.setAdapter(tesListAdapter );
My Adapter Class :
public class ProfissoesListAdapter extends ArrayAdapter<Test> { **<==HERE**
private LayoutInflater inflater;
private int resource;
public TesListAdapter(Context activity, int resource, List<Test> listaProf) **<==HERE**{
super(activity, resource, listaProf);
this.inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.resource = resource;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
...
2) The code below : YES... getView() does get called when I type in autocompletetextview. watch out in the fragment the String[] array and the adapter exteding ArrayAdapter
public class SigninFragment extends Fragment {
private List<Test> list= null;
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
String[] list = {"abcde","bbbbbb","bbbakaka","ccccccc","dddddd"};
tesListAdapter =
new TesListAdapter(
rootView.getContext()
,R.layout.list_row_adapter
,list);
autocompletetextview.setThreshold(3);
autocompletetextview.setAdapter(tesListAdapter );
My Adapter Class :
public class ProfissoesListAdapter extends ArrayAdapter<String> { **<==HERE**
private LayoutInflater inflater;
private int resource;
public TesListAdapter(Context activity, int resource, String[] listaProf) { **<==HERE**
super(activity, resource, listaProf);
this.inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.resource = resource;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
...
QUESTION: Why the 1) option does not call my getView in the adapter class when I type matching value in the autocomplete textview ? thx