Я хочу создать простое приложение для конвертации валют.Будет список стран с названием каждой валюты.Теперь я хочу, чтобы мои пользователи могли вводить название страны или название валюты (например, обломки или Корея) в AutoCompleteTextView поверх моего счетчика.Поиск в textView покажет только соответствующие результаты в моем счетчике.
Я понимаю, что мне нужно установить (подключить) и счетчик, и автозаполнение к одному адаптеру, но он не работает.
Есть идеи?
public class CustomSpinnerAdapter extends BaseAdapter implements ListAdapter, Filterable {
Context context;
int flags[];
String[] countryNames;
LayoutInflater inflter;
public CustomSpinnerAdapter(Context applicationContext, int[] flags, String[] countryNames) {
this.context = applicationContext;
this.flags = flags;
this.countryNames = countryNames;
inflter = (LayoutInflater.from(applicationContext));
}
@Override
public int getCount() {
return flags.length;
}
@Override
public Object getItem(int i) {
return null;
}
@Override
public long getItemId(int i) {
return 0;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
view = inflter.inflate(R.layout.customspinneritems, null);
ImageView icon = (ImageView) view.findViewById(R.id.imageView);
TextView names = (TextView) view.findViewById(R.id.textView);
icon.setImageResource(flags[i]);
names.setHint("AAAA");
names.setText(countryNames[i]);
return view;
}
@Override
public Filter getFilter() {
return null;
}
}