Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom autocompletetextview adapter not filtering and inputting weird strings
    text
    copied!<p>I have made a custom adapter for a autocompletetextview, but it's not filtering on the text and inputting weird strings when you select a item. Like this string: </p> <pre><code>listadapters.LocatieRowItem@BSE433q4e30 </code></pre> <p>I have made this adapter so the first item of the autocompletetextview could have a image and a different color then the rest.</p> <p>Here is my custom adapter: </p> <pre><code>public class LocatieAdapter extends ArrayAdapter&lt;LocatieRowItem&gt; { Context context; private List&lt;LocatieRowItem&gt; items; public LocatieAdapter(Context context, int resourceId, List&lt;LocatieRowItem&gt; items) { super(context, resourceId, items); this.context = context; this.items = items; } /*private view holder class*/ private class ViewHolder { ImageView imageView; TextView txtTitle; } public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; LocatieRowItem rowItem = items.get(position); LayoutInflater mInflater = (LayoutInflater) context .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (convertView == null) { convertView = mInflater.inflate(R.layout.locatieitem, null); holder = new ViewHolder(); holder.txtTitle = (TextView) convertView.findViewById(R.id.text1); holder.imageView = (ImageView) convertView.findViewById(R.id.logo); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if(rowItem.getTitle().equals("huidige locatie")) { if (holder.imageView.getVisibility() != View.VISIBLE) { holder.imageView.setVisibility(View.VISIBLE); holder.txtTitle.setTextColor(Color.parseColor("#33B5E5")); holder.txtTitle.setPadding(40, 10, 5, 5); } } else { holder.imageView.setVisibility(View.GONE); holder.txtTitle.setTextColor(Color.parseColor("#333333")); holder.txtTitle.setPadding(10, 10, 10, 10); } holder.txtTitle.setText(rowItem.getTitle()); //convertView.setBackgroundColor(position % 2 == 0 ? Color.WHITE : Color.parseColor("#F8F8F8")); return convertView; } </code></pre> <p>}</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload