Eugenu Yansky Eugenu Yansky - 5 months ago 29
Android Question

Show/Hide hint text for editText when enable fullsreen mode

How show hint text when open edittext in fullscreen mode?
I'm can show hint text with OnFocusChangeListener.

editChangeName.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View view, boolean b) {
editChangeName.setHint(b ? getResources().getString( : "");


How hide hint text after closing edittext?

   // assuming you have a EditText view with id 
   View viewById = getView().findViewById(;
   if(viewById!=null) {
           //  set listener to this view "many views could share one listener"
           viewById.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                public void onFocusChange(View v, boolean hasFocus) {
                    // if view match id &&  has no focus 
                    if(v.getId() == && !hasFocus) 
                             // clear hint 
                             ((EditText) v).setHint(null);
                    // else show hint 

hasFocus <- as name says

  • has (true) -> show
  • doesn't have (false) -> hide

if you are not sure if view by id is one you assign to an edit text do a check ( double check will not hurt)

  if (EditText.class.isAssignableFrom(v.getClass()))
     // do cast  
     EditText editText = (EditText) v;

This code is correct. But. How hide hinttext, after closing softkeyboard.. edittext have focus – Eugenu Yansky

Detecting when user has dismissed the soft keyboard

How to remove focus without setting focus to another control?

How to clear focus and remove keyboard on Android?