I have a weird setup of fragments and editText views, and basically I need the fragment to be removed everytime a specific editText view is clicked.
This works, but only about 80% of the time.
The other 20% of the time where it fails, if you click it again, it 100% hides.
It’s as if the first time you hit it, it doesn’t have enough time to react and hide the fragment before the keyboard pops out.
My xml has Clickable set to true and onClick set to hide.
My java is here:
public void hide(View view) {
FragmentTransaction transaction = getSupportFragmentManager()
.beginTransaction();
try {
transaction.remove(timerFragment);
transaction.commit();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Any ideas?
I ended up getting the problem resolved in another topic. I needed an onTouch method instead of an onClick. Look here: onClick event is not triggering | Android