I am trying to transfer an image from my folder. It worked before, but now, for some reason, when I try to share, I will choose a person to share it with, and it will give me a message that says: "the file format is not supported." For some reason I cannot share it with Whatsapp, but I can share it with another application like snapchat. Therefore, I know that he is getting the right image.
Here is my sharing code:
Uri imageUri;
imageUri = Uri.parse("android.resource://" + getPackageName() + "/drawable/" + "image" + String.valueOf(mViewPager.getCurrentItem() + 1));
Log.d("Sharing", "android.resource://" + getPackageName() + "/drawable/" + "image" + String.valueOf(mViewPager.getCurrentItem() + 1));
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("image/jpg");
sharingIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
Here is the error I got from the logs, but I am not using ArrayList for sharing.
W/Bundle: Key android.intent.extra.STREAM expected ArrayList but value was a android.net.Uri$StringUri. The default value <null> was returned.
And what gives Log.d:
D/Sharing: android.resource://com.trommelen.okke.scheurkalender/drawable/image155
source
share