Code example for AutoCompleteTextView

Methods: clearFocus, getWindowToken

0
 
	/*********************** Set All Views and Listeners ***************************/ 
	// hides the keyboard when the user has made a selection 
	private void hideKeyboard() { 
		InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.hideSoftInputFromWindow(busText.getWindowToken(), 0);
		busText.clearFocus();
	} 
 
	// populate the destination view upon selection of the bus 
	private void populateSpin() { 
		ArrayList<String> directions = getAllDirections();
		ArrayAdapter<String> directionAdapter = new ArrayAdapter<String>(self,
				R.layout.layout_dropdown, directions);
		dirSpin.setAdapter(directionAdapter);
		dirSpin.setVisibility(View.VISIBLE);
	} 
 
	// what happens when user makes a selection of bus 
	private void setDropDownListener() {