I am try to to use the text entered into an EditText, which that EditText is on a PopupWindow. This is my code for the PopUpWindow.
public void popupInit() {
View popupView = null;
popupView = inflater.inflate(R.layout.poplayout, null);
popUp = new PopupWindow(popupView, LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
popUp.setFocusable(true);
popUp.setOutsideTouchable(isRestricted());
popUp.setContentView(inflater.inflate(R.layout.poplayout, null, false));
login = (Button) popupView.findViewById(R.id.loginButton);
final EditText username = (EditText) popupView.findViewById(R.id.username);
final EditText password = (EditText) popupView.findViewById(R.id.password);
user_name =username.getText().toString();
pass_word = password.getText().toString();
}
when ran, the above code returns "" for both user_name and pass_word, which are field strings.
Thanks.
Here is the piece of working code for you,change accordingly:
Brief Explanation:
when btnId is clicked a popup opens and when you enter username and password and click loginbutton, the popup dismisses and username password you entered will be printed in logs. check your LogCat to see what you have entered.
To answer your question posted in comments, you should have something like below in your popupInit() method: