android - getting editText input from PopUpWindow -


i wondering how input edittext box in popupwindow. tried 2 ways. 1 layout inflator , 1 without either "" or null though typed box

this 1 returns "" :

// username , password inputs         view inflatedview = getlayoutinflater().inflate(r.layout.login_popup, null);         edittext usernameinput = (edittext) inflatedview.findviewbyid(r.id.username_login_input);         edittext passwordinput = (edittext) inflatedview.findviewbyid(r.id.password_login_input);          final string usernamestring = usernameinput.gettext().tostring();         final string passwordstring = passwordinput.gettext().tostring(); 

this 1 returns null :

// username , password inputs         edittext usernameinput = (edittext) findviewbyid(r.id.username_login_input);         edittext passwordinput = (edittext) findviewbyid(r.id.password_login_input);          final string usernamestring = usernameinput.gettext().tostring();         final string passwordstring = passwordinput.gettext().tostring(); 

i trying login_popup.xml not generated activity

this code from

edit

layoutinflater layoutinflater =                   (layoutinflater) getbasecontext().getsystemservice(layout_inflater_service);         view popupview = layoutinflater.inflate(r.layout.login_popup, null);         ppw = new popupwindow(popupview, layoutparams.wrap_content, layoutparams.wrap_content, true);         viewgroup parentlayout = (viewgroup) findviewbyid(r.id.title_page_layout);         // set position , size of popup         ppw.showatlocation(parentlayout, gravity.center, 10, 20); 

try following instead when popup window closed:

view contentview = ppw.getcontentview(); edittext usernameinput = (edittext) contentview.findviewbyid(r.id.username_login_input); edittext passwordinput = (edittext) contentview.findviewbyid(r.id.password_login_input); final string usernamestring = usernameinput.gettext().tostring(); final string passwordstring = passwordinput.gettext().tostring(); 

i think current approach inflating new views, rather obtaining existing views popup window.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -