javaandroideclipseadk

Why is MODE_WORLD_READABLE crossed out?


I'm developing an app for android, and I need to write data to a text file to read later in other activities. Here is my body of the code in question.

        //writes the string "hello android" to file
        FileOutputStream outFile = openFileOutput("myfile.txt", MODE_WORLD_READABLE);
        OutputStreamWriter osw = new OutputStreamWriter(outFile);
        String hello = "hello android.";
        osw.write(hello);
        osw.flush();
        osw.close();

When I first wrote this code, I was given a warning, so I added the line

@SuppressWarnings("deprecation")

to the top of my function. However, MODE_WORLD_READABLE is still crossed out in my IDE. Why? Note: the function has try-catch statements where they should be, and a "throws IOException at the top of the function.


Solution

  • The annotation @SuppressWarnings("deprecation") will suppress the warning (you will have no more yellow underline). However it will not suppress the fact that the element you are using is still deprecated and will leave it striked through.