Skip to content Skip to sidebar Skip to footer

Writing .txt File In Android

I need help with a problem in our system. We are using unity and visual studio C# to create a mobile VR game using gaze controls only (no controller). We need to find a way to writ

Solution 1:

here is a sample for saving a .txt file with StreamWriter.

class FileSaver
{
    static void Main()
    {
        // Create a StreamWriter instance
        StreamWriter writer = new 
        StreamWriter(Application.PersistentDataPath + "/droidlog.txt");

        // This using statement will ensure the writer will be closed when no longer used   
        using(writer)   
        {
            // Loop through the numbers from 1 to 20 and write them
            for (int i = 1; i <= 20; i++)
            {
                writer.WriteLine(i);
            }
        }
    }
}

this saves the numbers 1-20, you will want to fill in the blanks... good luck!


Post a Comment for "Writing .txt File In Android"