title: File.createTempFile() VS new File()
body: <p>In my app I added the possibility to add and save pictures for everyday day, represented by a <code>Fragment</code>.</p>
  
  <p>In order to save the picture on the SD card, I currently use the function <code>File.createTempFile</code>:</p>
  
  <pre><code>File imageFile = File.createTempFile(imageFileName, MyApplication.JPEG_FILE_SUFFIX, MyApplication.getAlbumDir());
  </code></pre>
  
  <p>I actually also tried with the standard way:</p>
  
  <pre><code>File imageFile = new File(MyApplication.getAlbumDir(), imageFileName + MyApplication.JPEG_FILE_SUFFIX);
  </code></pre>
  
  <p>Both are working, but in my case the first one is better than the second one because the function <code>createTempFile</code> adds a long random number at the end of the file name making it unique.</p>
  
  <p>To give you an example, here is what I get with both methods:</p>
  
  <p>With <strong>createTempFile</strong>: <code>IMG_2013-06-18_-1961144729.jpg</code></p>
  
  <p>With <strong>new File</strong>: <code>IMG_2013-06-18_.jpg</code></p>
  
  <p>Finally my question is, is it safe to keep using <code>createTempFile</code> to save my pictures or do I have to use the standard way and add some code to generate a unique file name? Should it only be used for temporary files?</p>
  
  <p>I reviewed the documentation about the function but I did not find anything about the possible consequences of using it instead of <code>new File</code>.</p>
  
  <p>Thank you</p>