Android dosen't show me keybord. I use Adapter with Edittext indise AlertDialog -


alertdialog works fine, shows me adpater, when click on edittext inside adapter, keybord dosen't open. besides that:

 log.d(log_tag, "item:"+item)  

inside onclicklistener dosen't work.

public class addproduct extends activity implements onclicklistener {    string log_tag;   button fillfields;    arraylist<string> somearray;   boxadapter boxadapter;    @suppresswarnings("deprecation") public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      setcontentview(r.layout.newproduct);      fillfields=(button)findviewbyid(r.id.fillfields);     fillfields.setonclicklistener(this);     somearray=new arraylist<string>();     boxadapter = new boxadapter(this, somearray);     }  @override public void onclick(view v) {     // todo auto-generated method stub      switch (v.getid()){     case r.id.fillfields:            alertdialog.builder alert = new alertdialog.builder(this);             alert.settitle("Поля товара");              alert.setadapter(boxadapter, new dialoginterface.onclicklistener() {                     public void onclick(dialoginterface dialog, int item) {                         log.d(log_tag, "item:"+item);                     }});             alert.create().show();        break;     }     }      } 

and adapter:

 public class boxadapter extends baseadapter {    context ctx;   layoutinflater linflater;   arraylist<string> objects;   oneditoractionlistener myeditoractionlistener;   string log_tag;   edittext edittext;  boxadapter(context context, arraylist<string> getfields){       ctx = context;         objects = getfields;         linflater = (layoutinflater) ctx             .getsystemservice(context.layout_inflater_service); }  @override public int getcount() {     // todo auto-generated method stub     return objects.size(); }  @override public object getitem(int position) {     // todo auto-generated method stub     return objects.get(position); }  @override public long getitemid(int position) {     // todo auto-generated method stub      return position; }  @override public view getview(int position, view convertview, viewgroup parent) {        // используем созданные, но не используемые view     view view = convertview;     if (view == null) {     view = linflater.inflate(r.layout.addproduct_item, parent, false);     }      ((textview) view.findviewbyid(r.id.addproducttextview)).settext(objects.get(position));        edittext = (edittext) view.findviewbyid(r.id.addproductedittext);      return view;  }  } 

so, doing wrong? thank you.

well, must show code , not partial, , better if show logcat,

but, force show keyboard in dialog, use (i not know if best way, but, 1 way):

    yourdialog.getwindow().setsoftinputmode(windowmanager.layoutparams.soft_input_state_always_visible); 

it depends how getting dialog, but, if using fragmentdialog or method (deprecated) oncreatedialog, should declare dialog var final.

regards.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -