title: Created HTML file isn't recognized by my device
body: <p>I create a test html file on an Android (7.0) device from string content. File is created fine, shows up with right extension and icon, but format isn't recognized when tapped, giving message "file format is not supported". Yet, if I save this same file to PC and transfer back to device, the issue disappears. It then shows app choices to open html, as it should be. </p>
  
  <p>Tried several write methods. In all cases file was created and content looked right, but format wasn't recognized rightaway. Can't figure out why, is there an extra step or written data required for this? The latest one was with BufferedWriter (to ensure UTF-8) as below:</p>
  
  <pre><code>  final File file = new File(path, name + file_extension);
    StringBuilder strBuilder = new StringBuilder();
  
    strBuilder.append("test");
    strBuilder.insert(0, "&lt;html&gt;"+"\r\n"+"&lt;body&gt;&lt;p&gt;"+"\r\n");
    strBuilder.insert(strBuilder.length(), "\r\n"+"&lt;/p&gt;&lt;/body&gt;"+"\r\n"+ "&lt;/html&gt;");
  
    String html_content=strBuilder.toString();
  
    try
    {
  
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8));
    bw.write(html_content);
    bw.close();
  
    } catch (IOException e)
    {
      e.printStackTrace();
        Log.e("Exception", "File write failed: " + e.toString());
    }
  </code></pre>