Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Autocomplete not functioning how is supposed to..!
    primarykey
    data
    text
    <p>I have this Autocomplete class and I am modifying the adapter so that, instead of just text, it will show an icon in front of the text that appears. All the choices available are stored in an array of strings.</p> <p>Now, for some reason, it only shows 5 items no matter what I type.</p> <pre><code>public class AutoCompleteText extends Activity{ public class CustomAdapter extends ArrayAdapter&lt;String&gt;{ public CustomAdapter(Context context, int textViewResourceId,String[] objects) { super(context, textViewResourceId, objects); } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getLayoutInflater(); View row = inflater.inflate(R.layout.arow,parent, false); TextView label = (TextView) row.findViewById(R.id.element); label.setText(listItems[position]); ImageView icon = (ImageView) row.findViewById(R.id.image); if("Item1".equals(listItems[position])|| something else || something else){ icon.setImageResource(R.drawable.img1); } else if("Item2".equals(listItems[position])|| something else || something else){ icon.setImageResource(R.drawable.img2); } else if("Item3".equals(listItems[position])|| something else || something else){ icon.setImageResource(R.drawable.img3); } else if("Item4".equals(listItems[position])|| something else || something else){ icon.setImageResource(R.drawable.img4); } else if("Item5".equals(listItems[position])|| something else || something else){ icon.setImageResource(R.drawable.img5); } else if("Item6".equals(listItems[position])|| something else || something else) { icon.setImageResource(R.drawable.img6); } else{ icon.setImageResource(R.drawable.whatever); } return row; } } AutoCompleteTextView acTextView; private static String listItems[] = { "Item1", "Item2","Item3","Item4","Item5", "Item6", "Item7", "Item8", "Item9", "Item10" "Item11", "Item12","Item13","Item14","Item15", "Item16", "Item17", "Item18", "Item19", "Item20"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.search); acTextView = (AutoCompleteTextView)findViewById(R.id.searchfield); acTextView.setThreshold(1); acTextView.setAdapter(new CustomAdapter(AutoCompleteText.this,R.layout.arow, listItems)); acTextView.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { try { //random staff } catch (ClassNotFoundException e) { e.printStackTrace(); } } } ); } </code></pre> <p>}</p> <p>the app compiles and runs fine without any errors. Can anyone help me on this? Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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