1

我是android Java的新手。我正在尝试使用 Phonegap 在 android 应用程序中共享图像。我得到新类“共享”作为 CordovaPlugin,代码如下...

Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/*");
Uri uri = Uri.parse("file:///android_asset/www/sharethis.png");
share.putExtra(Intent.EXTRA_STREAM, uri);
cordova.getActivity().startActivityForResult(share, 0); 

上面的代码不起作用,它显示如下......

在此处输入图像描述

是认为我无法获得确切的图像文件位置。我的文件位置

在此处输入图像描述

我也尝试了以下代码,但不起作用,

   String imagePath = Environment.getExternalStorageDirectory()
                + "/assets/www/sharethis.png";
4

1 回答 1

0

Android asset folder is private to your app so you can't share files from there directly. You need to copy the file from assets to a public directory in the filesystem and then send the share intent pointing to the public file

于 2015-04-12T09:47:59.760 回答