Jump to content

Problem with android app

FakezZ

So I am making an android app and I want to write a string to a file. The problem is that whenever I do that, the file is empty. I have checked and the string I input in the function is not empty. Anyway, here is the code responsible for the write operation:

    public void writeToFile(String text, String dir)    {        try        {            FileOutputStream out = new FileOutputStream(new File(dir));            PrintWriter fileOut = new PrintWriter(out);            fileOut.print(text);            out.close();            fileOut.close();        }catch(Exception e)        {                    }    }

MacBook Pro 15' 2018 (Pretty much the only system I use)

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×