Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File.mkdirs warning from Android Studio

in my app I create a new dir in 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 continues to report me this warning:

Result of "File.mkdirs()" is ignored

Anyone can explain me why? Thank you.

like image 647
shaithana Avatar asked Sep 25 '14 13:09

shaithana


1 Answers

because you dont do anything with what it returns, you just ignore it

ex.

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

you dont need to do anything, its just a warning

like image 125
tyczj Avatar answered Sep 18 '22 05:09

tyczj