android - Set value of hidden field with corresponding data of item selected from AutoCompleteTextView -


i've autocompletetextview suggests name of place stored in mysql database calling api, when text changes, using ontextchanged. response json array many items place_name, id, location_key,query_type, request_type, etc.(each own different purpose). i've 3 hidden edittext field. on setonitemclicklistener, when user selects place name, want these 3 hidden fields have value automatically set location_key, query_type , request_type, need send along these 3 values place name required result api.

once click on place_name field, hidden edittexts should values need send database. can obtained doing following:

textmessage.addtextchangedlistener(new textwatcher(){     public void aftertextchanged(editable s) {         if (textmessage == "//name of place") {             edittext1.settext "//whatever need";             edittext2.settext "//whatever need";             edittext3.settext "//whatever need";         }     } });  

alternatively, use spinner place name , code similar this:

@override public void onclick(view arg0) {

    int range = spndonate.getselecteditemposition();      donator_name = tboxname.gettext().tostring();     switch(range) {         case 0:             edittext1.settext = "//whatever need";             edittext2.settext = "//whatever need";             edittext3.settext = "//whatever need";             break;         case 1:             edittext1.settext = "//whatever need";             edittext2.settext = "//whatever need";             edittext3.settext = "//whatever need";             break;         case 2:             edittext1.settext = "//whatever need";             edittext2.settext = "//whatever need";             edittext3.settext = "//whatever need";             break;     } } 

hope helps :)


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -