java - Eclipse: Creating a search box with the attributes Enter city, zipcode -
hello have little no experience using eclipse wondering how create search field user can enter value. want search field enter city or zipcode until user inputs something. on html it's simple, wondering if knew on eclipse. googled somethings didn't see kept linking me swt widget doesn't seem right. thank in advance
this xml file.
<!-- editext search --> <edittext android:id="@+id/inputsearch" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/search" android:inputtype="textvisiblepassword"/> <!-- list view --> <listview android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </linearlayout>
this above code creates search box user can search city or zipcode.
in java file this.
edittext inputsearch; inputsearch = (edittext) findviewbyid(r.id.inputsearch); inputsearch.addtextchangedlistener(new textwatcher() { @override public void ontextchanged(charsequence cs, int arg1, int arg2, int arg3) { // when user changed text androidlistviewactivity.this.adapter.getfilter().filter(cs); } @override public void beforetextchanged(charsequence arg0, int arg1, int arg2, int arg3) { } @override public void aftertextchanged(editable arg0) { } });
create filter , show item in list of xml above.
Comments
Post a Comment