Setting file name for saving .JPG
<p>I am stuck.  I am converting a LinearLayout to a Bitmap, saving it, and then E-mailing it.  The issue I have is I want to set the file name so it overwrites the previous file name. The main purpose is to email the LinearLayout as an image.  From what I read you have to save it to the SD card first.  I am fine with that but I only want to have one saved image at all times.  I am getting a file name with what seems like a random 13 digit file name like (1329676773253.jpg) Here is the code.</p>

<pre><code>void image() {

    llImage.setDrawingCacheEnabled(true);
    test2 = Bitmap.createBitmap(llImage.getDrawingCache());
    ContentValues values = new ContentValues();
    values.put(Images.Media.TITLE, "001");
    values.put(Images.Media.DISPLAY_NAME, "ast.jpg");
    values.put(Images.Media.DATE_ADDED, System.currentTimeMillis());
    values.put(Images.Media.MIME_TYPE, "image/jpeg");

    Uri uri2 = getContentResolver().insert(
            Images.Media.EXTERNAL_CONTENT_URI, values);
    try {
        OutputStream outStream = getContentResolver()
                .openOutputStream(uri2);
        test2.compress(Bitmap.CompressFormat.PNG, 100, outStream);

        outStream.flush();
        outStream.close();
        Log.d("done", "done");
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }



    final Intent emailIntent = new Intent(
            android.content.Intent.ACTION_SEND);
    emailIntent.setType("text/html");
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");
    emailIntent.putExtra(Intent.EXTRA_STREAM, uri2);
    emailIntent.setType("image/png");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
            Html.fromHtml("" + finalEmail));
    startActivity(Intent.createChooser(emailIntent, "Email:"));

}
</code></pre>
