1

I have created a content provider (a word and its definition database). I also have an activity that will display a word and its definition, this activity requires two things: a custom Parcelable extra, and of course the word.

The goal is that in big texts in my app, Linkify will match some words, and when the user clicks on it it will display an activity with the word and its definition. The words are stored in a database, hence the content provider. The activity requires the word to be displayed, and an additional Parcelable. However Linkify does not provide access to the Intent. Currently the intent only contains the word to be defined.

What whould I do to be able to add the custom Parcelable to the Intent created implicitly by Linkify.addLinks?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Benoit Duffez
  • 11,839
  • 12
  • 77
  • 125

1 Answers1

0

After looking in the source I have located where the Intent is created: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/text/style/URLSpan.java

Thanks to open source, I created my own Linkify class (copied from Linkify) which uses also its own URLSpan copy, that takes into account the Parcelable I wanted to use.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Benoit Duffez
  • 11,839
  • 12
  • 77
  • 125