2

在我正在创建的应用程序中,我想通过电子邮件发送图像,因此我使用以下代码来执行此操作:

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();
            }
        }

由于某种原因,我收到带有图像文件但没有文件类型扩展名的邮件,可能是什么原因?

4

0 回答 0