Android App Take/ Email Photo
I am currently writing an app that within a certain activity, we want the user to be able to take and email a photo to a desired email address. I am able to do both of these (take
Solution 1:
You must use startActivityForResult for taking the photo. After that you must use onActivityResult to send email:
@OverridepublicvoidonActivityResult(int requestCode, int resultCode, Intent data)
{
// TODO: Test for requestCode and resultCodetry {
IntentpicMessageIntent=newIntent(android.content.Intent.ACTION_SEND);
picMessageIntent.setType("image/jpeg");
picMessageIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(downloadedPic));
startActivity(Intent.createChooser(picMessageIntent, "Send Picture Using: "));
} catch (Exception e) {
Log.e("TAG", "sendPictureMessage() failed to start activity.", e);
Toast.makeText(this, "No handler", Toast.LENGTH_LONG).show();
}
}
Hope it will help.
Post a Comment for "Android App Take/ Email Photo"