i’m creating an application on which it is essential that none of the EditText-Views gets a focus. This should only happen, when the user points directly into one of them.
I managed to prevent the focus-gain onCreate() and onResume() via a Dummy EditText-Item.
But in my application i’m using tabs combined with scrollviews.
When the user changes to another tab for the first time, there seems to be no focus-gain (perfect!) but as soon as one switsches back to another tab my EditText-View gains focus…
I tried using die onXY events of the tabHost but didn’t really get it right…
I appreciate any help! Thanks in advance,
fbtb
This code only works on the first Tabchange… how can that be? The Toast is allways shown correctly but the focus is only set on the first Tabchange… i don’t get it at all 🙁
tabHost.setOnTabChangedListener(new OnTabChangeListener() {
@Override
public void onTabChanged(String bezeichner) {
Toast.makeText(getBaseContext(),"This is the Tab: " + tabHost.getCurrentTab() +" der String: "+bezeichner, Toast.LENGTH_LONG).show();
if (tabHost.getCurrentTab() == 0)
goBtn.requestFocus();
if (tabHost.getCurrentTab() == 1)
label_maxvolume.requestFocus();
}
});
Use this to remove focus from any Edittext
This will basically hide the keyboard whenever you want or wherever you want it hidden.