I'm having a share button which would share an image from drawable with text.
public boolean shareGame(String msg) {
if (Configuration.Share_WITH_IMAGE) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/png");
Uri uri = Uri
.parse("android.resource://" + getPackageName() + "/" + R.drawable.share_image);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.putExtra(Intent.EXTRA_TEXT, msg + " " + GOOGLE_PLAY_URL);
startActivity(Intent.createChooser(shareIntent, "Share: " + msg));
} else {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, msg + GOOGLE_PLAY_URL);
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, msg));
}
return true;
}
Currently, it returns an empty file without any extension when I try to share it through email. WhatsApp share gives an error of unsupported file type.
Do I need to convert this to Bitmap? If so, what's the best way to do it.
Thanks.