Android Studio does not recognize some commands

Asked

Viewed 72 times

-1

Does anyone know how to fix it? Out of nowhere these two commands stopped working

Note: When I run the application there is no error, but it still shows that there are errors in the code for some reason

getWindow AlertDialog.Builder

Also, even I using the function jogar() keeps showing that it has not been used yet, although the application is working properly without any bug

inserir a descrição da imagem aqui

  • 2

    I’m using the latest update and sometimes I have the same problem. The solution is to exit and enter again, preferably through File->Invalidity / Restart.

  • It is usually Android Studio cache. Try to clean using the option @ramaral said

1 answer

0

inosivel, the method getWindow is only supported with projects that have at least version 23 of android SDK, and in place of mainactivity.this use the method getApplicationContext() if you are creating Builder in Mainactivity.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.