I'm sending a CharSequence
of a Spannable
to another Activity via intent extras, but seem not to receive the same sequence.
I'm doing that according to the following answer: https://stackoverflow.com/a/45638248/1545435
Here's the content of learnMoreText
and how I'm sending it. It has 12
spans:
@Override
public void onItemLearnMoreClick(View view, int position) {
Intent intent = new Intent(getContext(), LearnMoreActivity.class);
CharSequence learnMoreText = model.getLearnMoreText(position);
intent.putExtra(LearnMoreActivity.EXTRA_LEARN_MORE, learnMoreText);
String learnMoreType = model.getLearnMoreType(position);
intent.putExtra(LearnMoreActivity.EXTRA_LEARN_MORE_TYPE, learnMoreType);
startActivity(intent);
}
Here's how I receive it in the LearnMoreActivity. Now it only contains 10
spans. The link-spans <a></a>
were striped:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActivityComponent().inject(this);
LearnMoreActivityBinding binding = DataBindingUtil.setContentView(this, R.layout.learn_more_activity);
CharSequence learnMoreHtmlText = getIntent().getCharSequenceExtra(EXTRA_LEARN_MORE);
binding.contentText.setText(learnMoreHtmlText);
binding.contentText.setLinksClickable(true);
binding.contentText.setMovementMethod(LinkMovementMethod.getInstance());
setupToolbar();
}
Can anyone point to the reason and how to fix?