title: New Line Command ("\n") Doesn't Working While Reading Files (Android) java
body: <pre><code>      String mystring="Hello"+"\n"+ "World" ;
  
          writeToFile(mystring);
          String newstring = readFromFile();
          mytextview.setText(newstring);
  </code></pre>
  
  <p><strong>my text view just shows "HelloWorld"  without newline</strong></p>
  
  <p><strong>I Couldn't understand why It doesn't recognizes "\n"</strong></p>
  
  <p><strong>These are my writetofile and readfromfile functions;</strong></p>
  
  <pre><code>private void writeToFile(String data) {
           try {
           OutputStreamWriter outputStreamWriter = new OutputStreamWriter(openFileOutput("myfilename", Context.MODE_PRIVATE));
           outputStreamWriter.write(data);
           outputStreamWriter.close();
           }
           catch (IOException e) {
          // Log.e(TAG, "File write failed: " + e.toString());
           }
           }
  
  
      //////////////////////////////////////////////////
      private String readFromFile() {
           String ret = "";
  
           try {
           InputStream inputStream = openFileInput("myfilename");
  
           if ( inputStream != null ) {
           InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
           BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
           String receiveString = "";
           StringBuilder stringBuilder = new StringBuilder();
  
           while ( (receiveString = bufferedReader.readLine()) != null ) {
           stringBuilder.append(receiveString);
           }
  
           inputStream.close();
           ret = stringBuilder.toString();
           }
           }
           catch (FileNotFoundException e) {
           //Log.e(TAG, "File not found: " + e.toString());
           } catch (IOException e) {
          // Log.e(TAG, "Can not read file: " + e.toString());
           }
           return ret;
           }
  </code></pre>
  
  <p>what I am trying to do is saving a string to phone's internal storage and read back the same string .</p>