I'm facing a strange problem. When I add an edittext using the following piece of code:
edit = new EditText(context);
edit.setInputType(InputType.TYPE_CLASS_TEXT);
edit.layout(0, 0, (int)searchPane[W], (int)searchPane[H]);
edit.setBackgroundColor(Color.TRANSPARENT);
edit.setGravity(Gravity.CENTER_VERTICAL);
edit.addTextChangedListener(SearchBox.this);
edit.setFocusable(true);
edit.setFocusableInTouchMode(true);
and draw it using edit.draw(Canvas)
in the onDraw
method of View
.
I'm calling edit.requestFocus()
in onTouchMethod
though it does not show the input keyboard on focus request. Any ideas how to make edittext accept text and show input keyboard?
Thanks in advance.