2

In the app i'm creating I would like to send an image via email, so I'm using the following code to do so:

send.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            String name = textName.getText().toString();
            String phone = textPhone.getText().toString();
            String message = textMessage.getText().toString();

            Intent i = new Intent(Intent.ACTION_SEND);
            i.setType("message/rfc822");
            i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"my@email.com"});
            i.putExtra(Intent.EXTRA_SUBJECT, "You have a new email");
            i.putExtra(Intent.EXTRA_TEXT   , "Name: "+ name + '\n' + 
                                             "Phone: " + phone + '\n' + 
                                             "Text" + message);
            i.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://com.rbz.jewlerysearchengine/" + imageAdapter.mThumbIds[position]));
            try {
                startActivity(Intent.createChooser(i, "Send mail..."));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(ContactUs.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
            }
        }

For some reason I receive the mail with the image file but without the file type extension, what can be the reason?

Daniel Nugent
  • 43,104
  • 15
  • 109
  • 137
RBZ
  • 173
  • 2
  • 9

0 Answers0