The android application on my current project has a layout that includes tabs at the top and each tab in turn will display a fragment when clicked. With this setup we started seeing problems entering data into EditText fields. The problem presented in the emulator and some devices and consisted on not being able to focus on these fields. In order to solve the problem we added a OnTouchListener in which we requested focus,

editText1.setOnTouchListener(new View.OnTouchListener() {
 
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				v.requestFocusFromTouch();
				return false;
			}
		});

This worked well for all our tests until we had to add a new piece of functionality that required an AutoCompleteText field. In this case the OnTouchListener displayed some odd behavior in some of our testing devices. While trying to figure out the reason for this, the following information proved to be very useful:

This along with some testing helped me determine that requestFocus works in my setup for every situation but one: when using physical keyboards. In the case where the physical keyboard of the device was exposed requestFocusFromTouch was able to obtain the foucs. Which lead me to modify my listener as follows:

autoCompleteText1.setOnTouchListener(new View.OnTouchListener() {
 
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				Configuration config = getResources().getConfiguration();
				if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
					v.requestFocusFromTouch();
				} else {
					v.requestFocus();
					InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
					imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
				}
				return false;
			}
		});

The listener for my AutoCompleteText field now detects if the physical keyboard is exposed and uses the correct requestFocus method. I also had to add some code to display the soft keyboard when using this approach since the behavior was not consistent between devices.