java - Android Studio ExpandableList asking for text input -


i have developed weight conversion application works fine. when app launched, @ top of layout number box user must input value, example, 160lbs or 50kg, select conversion want perform expandable list gives options of pounds kilos or kilos pounds.

the issue when number box above expandable list , user clicks input value, keyboard comes , instead of tick @ bottom right, when clicked hides keyboard , value in place, instead goes normal keyboard.

this happens when expandable below number box. when list above number box works fine. user inputs value , clicks tick @ bottom right. want able place list below number box without prompt keyboard showing up.

code here if needed not sure if part of code @ all:

import android.app.activity; import android.os.bundle; import android.view.view; import android.view.windowmanager; import android.widget.button; import android.widget.edittext; import android.widget.expandablelistview; import android.widget.textview; import android.widget.toast;  import java.util.arraylist; import java.util.hashmap; import java.util.list;  import static       com.example.mr_br.healthandfitnessapplication.r.id.activity_converter; import static com.example.mr_br.healthandfitnessapplication.r.id.edittype;   public class converteractivity extends activity {  //created hashmap expandable list hashmap<string, list<string>> weight_category; list<string> weight_list; expandablelistview exp_list; weightadapter adapter; public edittext edittext;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_converter);      //prevents edittext box being     //highlighted cursor after activity created.         getwindow().setsoftinputmode(windowmanager.layoutparams.soft_input_state_hidden);      //all variables used information on activity_converter     final edittext camount = (edittext) findviewbyid(r.id.editamount);     final edittext cpound = (edittext) findviewbyid(r.id.editpound);     final edittext ckilo = (edittext) findviewbyid(r.id.editkilo);     final edittext ctype = (edittext) findviewbyid(r.id.edittype);     final string variable = cpound.gettext().tostring();       exp_list = (expandablelistview) findviewbyid(r.id.exp_list);     weight_category = weightdata.getinfo();     weight_list = new arraylist<string>(weight_category.keyset());     adapter = new weightadapter(this, weight_category, weight_list);     exp_list.setadapter(adapter);       exp_list.setonchildclicklistener(new expandablelistview.onchildclicklistener() {         @override         public boolean onchildclick(expandablelistview parent, view v, int groupposition, int childposition, long id) {              string selection = exp_list.getitematposition(childposition+1).tostring();             string kilo = "kilograms";             string pound = "pounds";             string amount = camount.gettext().tostring();             ((textview)findviewbyid(edittype)).settext(selection);               if(amount.matches(""))             {                 toast.maketext(converteractivity.this, "please input value , click again", toast.length_long).show();                 return false;             }             if(selection.matches("kilograms pounds")) {                 ((textview)findviewbyid(edittype)).settext(kilo);                 double pound = double.valueof(camount.gettext().tostring());                 double kg = 2.2 * pound;                 cpound.settext(string.valueof(kg));             }             if(selection.matches("pounds kilograms")) {                 ((textview)findviewbyid(edittype)).settext(pound);                 double pound = double.valueof(camount.gettext().tostring());                 double kg=0.453592*pound;                 ckilo.settext(string.valueof(kg));             }              return false;         }       });       } 

}


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -