java - how to implement TextWatcher when my Json is ready? -


i newbie in android development, , facing problem project, want connect app local host, have seen ways , picked simplest 1 using json, stopped on way of implementing textwatcher adding in code. rest of things have done requires on steps.

please take @ code , tell me mistake?

this java code:

public class myactivity extends activity implements textwatcher { httpclient httpclient; private httppost mhttppost;  @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);       string[] mobilearray = {"laptops","iphone","windowsmobile","blackberry","webos","ubuntu","windows7","max os x"};     arrayadapter adapter = new arrayadapter<string>(this,r.layout.list_item,mobilearray);     listview listview = (listview) findviewbyid(r.id.listview);     listview.setadapter(adapter);      httpclient = new defaulthttpclient();     mhttppost = new httppost("http://10.0.2.1/index/get_for_mobile");      try {         httpresponse response = httpclient.execute(mhttppost);         httpentity ent = response.getentity();         string temp = entityutils.tostring(response.getentity());     }     catch (exception e ){}  } private textwatcher search = new textwatcher() {     @override     public void beforetextchanged(charsequence charsequence, int i, int i1, int i2) {      }      @override     public void ontextchanged(charsequence charsequence, int i, int i1, int i2) {      }      @override     public void aftertextchanged(editable editable) {      } }; 

}

and here xml code:

<!-- primary full-screen view. can replaced whatever view      needed present content, e.g. videoview, surfaceview,      textureview, etc. -->  <!-- framelayout insets children based on system windows using      android:fitssystemwindows. --> <searchview         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:id="@+id/searchview"          android:layout_marginbottom="48dp" />  <listview         android:layout_width="wrap_content"         android:layout_height="399dp"         android:id="@+id/listview"         android:layout_gravity="right|top"         android:choicemode="multiplechoice" android:clickable="true"/> 

you have not added textwatcher edittext or view ,of text event want handle .see http://developer.android.com/reference/android/text/textwatcher.html why need implement textwacther whicile ending json localhost .


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -