I have an app which converts meters
to centimeters
, simple, right?
So i have two parts on it. One being the keypad and the other one are the two edittext
boxes.
i was using my own keypad, so there was no sense for android keyboard to show up.
I looked upon various answers and they don't seem to work for me.
This question asks the same thing and i implemented the selected answer but the edittexts are behaving weirdly.
First one seem to work as i wanted it to work but somehow the other text won't come on focus.
I try to click on it and nothing happens.The focus just won't go from the first one.
What i tried
findViewById(R.id.lengthConverterSecond).setOnTouchListener(this);
findViewById(R.id.lengthConverterFirst).setOnTouchListener(this);
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
return true;
}
What's up with this weird behavior?
What would be the solution to my above problem?
update
Tried this tooo.
Just in case
findViewById(R.id.lengthConverterSecond).setOnFocusChangeListener(this); findViewById(R.id.lengthConverterFirst).setOnFocusChangeListener(this);
@Override
public void onFocusChange(View view, boolean b) {
if(b){
InputMethodManager im=(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
assert im != null;
im.hideSoftInputFromWindow(view.getWindowToken(),0);
}
}
This doesn't work at all, like it won't hide the keyboard but that weird behavior i witnessed above,doesn't happen now.