android - AutoCompleteTextview not functioning -


i trying set autocompletetextview in activity. no errors. on preview screen looks this(http://gyazo.com/7bf15e2b0b37f09d0d20ba883de49dce). however, when run app on phone or on emulator, looks this(http://gyazo.com/bf5d6cb733c03835a1061fd175c500a0) , no suggestions come have listed when type them in.

here's code, can me out here:

search screen xml:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/search_screen_medium" android:orientation="vertical" >  <autocompletetextview     android:completionthreshold="1"     android:id="@+id/autocomplete"     android:layout_width="250dp"     android:layout_height="wrap_content"     android:layout_gravity="center_horizontal"     android:layout_marginleft="10dp"     android:hint="@string/search_hint"     android:paddingright="10dp"     android:ems="10"     android:textcolor="#ffffff" /> <requestfocus /> </linearlayout>     

list detail xml:

<?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/componentlistdetail" android:layout_width="match_parent" android:layout_height="match_parent" android:textsize="20sp" android:padding="10dp" android:textcolor="#ffffff" >   </textview> 

java

package com.youtube.iamjackpot;  import android.r.string; import android.app.activity; import android.os.bundle; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.autocompletetextview;  public class searchmenuactivity extends activity {  string[] componentlist = {  "pizza", "cheese", "chocolate, "cake", "burger" };  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_searchmenu);     autocompletetextview actv = (autocompletetextview) findviewbyid(r.id.autocomplete);     actv.setadapter(new arrayadapter<string>(this,r.layout.componentlistdetail, componentlist));   };  } 

pass componentlist in adapter

actv.setadapter(new arrayadapter<string>(this,r.layout.componentlistdetail,componentlist)); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -