Exception when try to setError() in an editText inside a Popup Window

This is my code:

                InputMethodManager imm = (InputMethodManager)getSystemService(
                imm.hideSoftInputFromWindow(textNomeGiocatore.getWindowToken(), 0);

                textNomeGiocatore.setError("Nome giocatore necessario");


I have an error in the row :

 textNomeGiocatore.setError("Nome giocatore necessario");

this is the error :

 android.view.WindowManager$BadTokenException: Unable to add window -- token android.view.ViewRootImpl$W@426940a8 is not valid; is your activity running?

I try to post delayed the error message without resoult.

Someone Can help me?

Source: android

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.