Writing/Reading Files to/from Android phone's internal memory

Solution 1:

You can Read/ Write your File in data/data/package_name/files Folder by,

To Write

BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new 
                            File(getFilesDir()+File.separator+"MyFile.txt")));
bufferedWriter.write("lalit poptani");
bufferedWriter.close();

To Read

 BufferedReader bufferedReader = new BufferedReader(new FileReader(new 
                           File(getFilesDir()+File.separator+"MyFile.txt")));
 String read;
 StringBuilder builder = new StringBuilder("");

 while((read = bufferedReader.readLine()) != null){
        builder.append(read);
      }
 Log.d("Output", builder.toString());
 bufferedReader.close();