How to share custom text with other apps in android?
On a TextView I have implemented TypeFace by view.setTypeface(typeface);
Now I want to share that text with typeface over another application via intent. So I done the following:
CharSequence text = textView.getText();
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, text);
sendIntent.setType("text/*");
Intent shareIntent = Intent.createChooser(sendIntent, null);
checkBox.setChecked(false);
mContext.startActivity(shareIntent);
But the problem is I'm only getting the plain string not with the typeface.
i.e if I want to share
or
with other apps. But I'm ending of sharing
Example Text
with other apps.
Edit:
I have seen that in android there is a class SpannableString to store formatted string data with font family or typeface. This can be done by
SpannableString spannable = new SpannableString(textView.getText());
spannable.setSpan(myTypeface,0,textView.getText().toString().length()-1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
But still not able to find any way to share this with other apps.