Reputation: 113
Here's where I initialize the popUpWindow
popUp = new PopupWindow(this);
layout = new LinearLayout(this);
mainLayout = new LinearLayout(this);
tv = new TextView(this);
ques = new EditText(this);
sol = new EditText(this);
params = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
layout.setOrientation(LinearLayout.VERTICAL);
tv.setText("Hi this is a sample text for popup window");
layout.addView(ques, params);
popUp.setContentView(layout);
and here's where I'm trying to set the listener:
popUp.showAtLocation(layout, Gravity.BOTTOM, 10, 10);
popUp.update(50, 50, 300, 80);
popUp.setFocusable(true);
ques.clearFocus();
ques.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {}
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
public void onTextChanged(CharSequence s, int start, int before, int count) {
xx=ques.getText();
}});
ques.setEnabled(true);
ques.getText();
The popUp window appears fine and there's an editText in it, but it's as if it's not working, keyBoard doesn't show and if I write normally, it still appears blank.
Upvotes: 0
Views: 962
Reputation: 624
i had the same problem, just use:
popUp.setFocusable(true);
Upvotes: 2