File.mkdirs warning from Android Studio

in my application, I create a new directory this way;

File mydir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "/my_directory"); if (!mydir.exists()) { mydir.mkdirs(); } 

and it works well, but Android Studio (0.8.9) just keeps telling me about this warning:

The result of "File.mkdirs ()" is ignored

Can anyone explain to me why? Thanks.

+5
source share
2 answers

because you do not do anything with what it returns, you simply ignore it

ex.

 if(mydir.mkdirs()){ //do something }else{ //do something else } 

you don't have to do anything, it's just a warning

+9
source

You are ignoring the result of File.mkdir ()

Read this answer for more clearing

0
source

Source: https://habr.com/ru/post/1203402/


All Articles