Bom dia a todos, a duvida é a seguinte. Tenho alguns campos básicos(nome, telefone etc), e uma opção para tirar fotos. Eu já tenho funcionando o envio de e-mail e o botão para tirar foto, consigo pegar os valores de todos os campos e tirar a foto inclusive, porem quero saber como que eu faço para anexar a foto neste e-mail...
Esses são os métodos para tirar a foto e salva-la no cartão de memoria do celular.
public void abrirCamera(){
File picsDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File imageFile = new File(picsDir, "foto.jpg");
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
i.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile));
startActivity(i);
}
public void takePhoto(View view)
{
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File photo = new File(Environment.getExternalStoragePublicDirectory
(Environment.DIRECTORY_PICTURES), "Pic.jpg");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
imageUri = Uri.fromFile(photo);
startActivityForResult(intent, TAKE_PICTURE);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case TAKE_PICTURE:
if (resultCode == Activity.RESULT_OK) {
Uri selectedImage = imageUri;
getActivity().getContentResolver().notifyChange(selectedImage, null);
ImageView imageView = (ImageView) getActivity().findViewById(R.id.ImageView);
ContentResolver cr = getActivity().getContentResolver();
Bitmap bitmap;
try {
bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImage);
imageView.setImageBitmap(bitmap);
fotoCart.setText("");
//Toast.makeText(getActivity(), selectedImage.toString(), Toast.LENGTH_LONG).show();
} catch (Exception e) {
//Toast.makeText(getActivity(), "Failed to load", Toast.LENGTH_SHORT).show();
Log.e("Camera", e.toString());
}
}
}