0

I want to achieve the following

  1. In my app, there will be a screen which allows you to take a picture
    1. Once user has taken the picture, he will get an option to send the picture to the predefined email Id as an attachment.

Can someone throw some light or give me direction on how to achieve this?

Puru Tiger
  • 25
  • 7

1 Answers1

0

For info on how to take a photo in your app, take a look at the Android Developer documentation. It is detailed and it has a sample project that you can use.

To send emails, you could use the code snippet from this SO Answer, shown below:

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT   , "body of email");
try {
    startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
    Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}

I hope this helps.

Community
  • 1
  • 1
iRuth
  • 2,687
  • 3
  • 25
  • 32