How to check if a file exists?
<p>I'm trying to make a method that write a txt plain file on the external memory.. </p>

<p>And it works! .. but i want to insert the Date of creation on the footer of the file thorugh the file.exists() method.</p>

<p>If exists doesn't insert date and if not exists insert the date..</p>

<p>My code is this..</p>

<pre><code>File idea=new File(dir,titulo+".txt");
            FileWriter writer=new FileWriter(idea);
            if (!(idea.exists())){
                texto.append("\n\n\tCreada :"+new Fecha().toString());
            }
</code></pre>

<p>Supposing that dir is my path..</p>

<pre><code>    File dir =new File(Environment.getExternalStorageDirectory(),"/CMI");
</code></pre>

<p>and titulo is a parameter that the metod get when is called .. and contains the filename.</p>

<p>(Fecha it's my Date class that returns a Date as String)</p>
