Javascript “的图像路径”;电邮;phonegap的份额

Javascript “的图像路径”;电邮;phonegap的份额,javascript,android,cordova,Javascript,Android,Cordova,我已经为图片实现了幻灯片功能,现在需要将当前页面设置为电子邮件正文,并在phonegap中共享。我可以发送电子邮件,但不能与图像一起发送,我可以将第一个图像设置为当前页面并设置路径吗?请帮助我为滑动图像提供正确的路径 这是我的java意图代码 private void doSendIntent(String subject, String text) { Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);

我已经为图片实现了幻灯片功能,现在需要将当前页面设置为电子邮件正文,并在phonegap中共享。我可以发送电子邮件,但不能与图像一起发送,我可以将第一个图像设置为当前页面并设置路径吗?请帮助我为滑动图像提供正确的路径

这是我的java意图代码

private void doSendIntent(String subject, String text) {
    Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);

    sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
    sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, text);           
    this.cordova.startActivityForResult(this, sendIntent, 0);      
    File path = new File(Environment.getExternalStorageDirectory()+"file_path");
    sendIntent.putExtra(android.content.Intent.EXTRA_STREAM,Uri.fromFile(new File(path.getAbsolutePath())));
}
已经用javascript实现了图像扫描

  <div class="swiper-container">
  <div class="swiper-wrapper">
  <div class="swiper-slide red-slide">
     <img src="images/v2.jpg" >
     <div class="wrapper">
     <button class="button" id="Email" onclick="share()">Hello</button>         </div> 
   </div>

  <div class="swiper-slide blue-slide">
    <img src="images/v.jpg" >
   <div class="wrapper">
  <button class="button" id="Email" onclick="share()">Hello</button>
  </div>                
  </div>
  <div class="pagination"></div>
  </div>

 <script>
 var mySwiper = new Swiper('.swiper-container',{
  pagination: '.pagination',
 paginationClickable: true
 })
 </script> 

你好
你好
var mySwiper=new Swiper(“.Swiper container”{
分页:'.pagination',
分页可点击:true
})
试试这个

sendIntent.putExtra(android.content.Intent.EXTRA_STREAM,Uri.fromFile(new File(Environment.getExternalStorageDirectory().getPath()+filepath.jpg)));
尝试设置类型

Bitmap icon = mBitmap;
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
icon.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
File f = new File(Environment.getExternalStorageDirectory() + File.separator + "temporary_file.jpg");
try {
    f.createNewFile();
    FileOutputStream fo = new FileOutputStream(f);
    fo.write(bytes.toByteArray());
} catch (IOException e) {                       
        e.printStackTrace();
}
share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/temporary_file.jpg"));
startActivity(Intent.createChooser(share, "Share Image"));

如果您正在尝试使用资产文件夹,请查看此

谢谢您的回复,我有10个图像正在滑动,如何为所有10个图像提供路径@Amit Prajapati图像位于资产文件夹@Amit Prajapati中