Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Gmail客户端(Android)通过电子邮件发送多张照片_Android_Gmail_Photo - Fatal编程技术网

使用Gmail客户端(Android)通过电子邮件发送多张照片

使用Gmail客户端(Android)通过电子邮件发送多张照片,android,gmail,photo,Android,Gmail,Photo,告诉我如何实现从相机发送多个图像。此示例仅适用于1个图像。我浏览了论坛,我自己没有发现任何东西,也许有人知道答案,请告诉我。 在本例中,我仅通过photoURI变量发送1张图像,在我的示例中,我感兴趣的是发送2-3张相机快照的图像 我的代码片段: @Override public void onClick(View v) { String emailSubject = textSubject.getText().toString(

告诉我如何实现从相机发送多个图像。此示例仅适用于1个图像。我浏览了论坛,我自己没有发现任何东西,也许有人知道答案,请告诉我。 在本例中,我仅通过photoURI变量发送1张图像,在我的示例中,我感兴趣的是发送2-3张相机快照的图像

我的代码片段:


         @Override
         public void onClick(View v) {

             String emailSubject = textSubject.getText().toString();
             String emailText = textMessage.getText().toString();

             Intent intent = new Intent();

             intent.putExtra(Intent.EXTRA_EMAIL, new String[]{odooAdress});
             intent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
             intent.putExtra(Intent.EXTRA_TEXT, emailText);
             intent.putExtra(Intent.EXTRA_STREAM, photoURI);
                      
             intent.setType("message/rfc822");

             intent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmailExternal");                          
             try {
                 startActivity(intent);

             } catch (ActivityNotFoundException ex) {                   
             }                
             mUriList.clear();
         }
     });
     return root;
 }

 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {

     if (resultCode == RESULT_OK) {
         switch (requestCode) {
             case RQS_LOAD_IMAGE:
                 Uri imageUri = data.getData();
                 mUriList.add(imageUri);
                 mFileListAdapter.notifyDataSetChanged();
                 break;
             case RQS_SEND_EMAIL:
                 break;
         }
     }    
 }

 private File createImageFile() throws IOException {
     
     String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
     String imageFileName = "JPEG_" + timeStamp + "_";
     File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
     File image = File.createTempFile(
             imageFileName,  
             ".jpg",         
             storageDir      
     );        
     mCurrentPhotoPath = image.getAbsolutePath();
     return image;
 }

 private void dispatchTakePictureIntent() {
     Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);        
     if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {            
         File photoFile = null;
         try {
             photoFile = createImageFile();
         } catch (IOException ex) {                
             Toast.makeText(getActivity(), "Error!", Toast.LENGTH_SHORT).show();
         }            
         if (photoFile != null) {
             photoURI = FileProvider.getUriForFile(getActivity(), "xyz.devdiscovery.example.FileProvider", photoFile);

             takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
             startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
         }
     }
 }

尝试使用
操作\u发送\u多个