Attaching an image to an email
<p>Writing an app which takes a picture from the camera and retrieves it as a bitmap. I then write this file to the disk and attempt to send the picture as an email, in the gmail app it says there is an attachment however when I receive the email no file is attached. Here are the two appropriate methods I am trying to get working.</p>

<pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
    if (requestCode == CAMERA_PIC_REQUEST) {  
    thumbnail = (Bitmap) data.getExtras().get("data");  
    ImageView image = (ImageView) findViewById(R.id.photoResultView);  
    image.setImageBitmap(thumbnail);


    try {
            pic = new File("pic");

        FileOutputStream out = new FileOutputStream(pic);
        thumbnail.compress(CompressFormat.PNG, 100, out);
        out.flush();
        out.close();

    }
    catch (java.io.FileNotFoundException e) {
        // that's OK, we probably haven't created it yet
    }
    catch (Throwable t) {
        Toast
            .makeText(this, "Exception: "+t.toString(), Toast.LENGTH_LONG)
            .show();

    }   
    sendPictureButton.setVisibility(Button.VISIBLE);
    }  
}
private OnClickListener sendPictureButtonListener = new OnClickListener() {

    @Override
    public void onClick(View arg0){

        Intent i = new Intent(Intent.ACTION_SEND);
        i.putExtra(Intent.EXTRA_EMAIL, new String[]{"fakeaddress@hello.edu"});
        i.putExtra(Intent.EXTRA_SUBJECT,"On The Job");
        i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(pic));

        i.setType("image/png");
        startActivity(Intent.createChooser(i,"Share you on the jobing"));

    }
    };
</code></pre>
