Android File Read Write Example

In Android File Read Write , we use the File class to communicate with files and folders on the disk. The File class is used to identify a file or folder in the specified location on disk.

Create a File

We check if the file exists and create that file first

Write to File

for Android File Read Write, we need to know the way to read this file once and read it

  • File:MainActivity

We print the text from the EditText to the above file

  • File:res/Layout/activity_main.xml

If you write edittext e and write it down on the button, it will be an image like

Read to File

  • File:MainActivity

We read from the file in the ReadTxt function above, we set the textView to the text and press the screen

  • File:res/layout/activity_main.xml

As you can see, we write the file with the write button and we read the file in the file with the read button.



if you have question do not forget to write from the chat button next to it or from the comment

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *