1

I am new in android Java. I am trying to share an image in android application using Phonegap. I get new class "Share" as CordovaPlugin, code is follow...

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

Above code is not working, it showing like this ...

enter image description here

is think i cant get Exact image file location. My file location

enter image description here

I tried bellow code also, But not work,

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

Please Help

suraj mahajan
  • 832
  • 1
  • 12
  • 21

1 Answers1

2

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. Have a look here

Community
  • 1
  • 1
Bojan Kseneman
  • 15,488
  • 2
  • 54
  • 59