Search code examples
androidandroid-activityurlspan

Android,start Activity by urlspan with extras?


As mentioned here,we can start Activity by Intent that is created with specific url,when Activity has desired intent filter.So we can start Activity by setting a URLSpan for SpanableString that is set as text for text view,like this:

ss.setSpan(new URLSpan("http:my.Activity"), 13, 17,
                   Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

When we use an Intent to start Activity,we can add more details as extras to intent and retrieve them in Activity by getExtras method.My question is:

Is there any way to start Activity by URLSpan and also send a String which can be retrieved by target Activity?


Solution

  • sure, extend URLSpan and override its onClick method