1

I have an activity which contains 2 textviews and an imageview. First textview contains the title, second contain description and in imageview corresponding image. In description part if any of the listed title come across it should be linkify and onclick it should create a page containing the title and corresponding description. It should work like wikipedia. I have stored all title and desc in string array.
I tried following this link... Android: Launch activity from clickable text

     UnderlineSpan[] underlines = strBuilder.getSpans(UnderlineSpan.class);

But I am getting error: The method getSpans(int, int, Class) in the type SpannableStringBuilder is not applicable for the arguments (Class)

How can i solve this problem? Or is there easier way to linkify between two different activities?

Thanks..

Community
  • 1
  • 1
sarah
  • 265
  • 1
  • 3
  • 13

2 Answers2

3

You need to add a start and end, like getSpans(0,strBuilder.length(),UnderlineSpan.class).

Ben Williams
  • 6,027
  • 2
  • 30
  • 54
  • @Ben yeah, That removed the error. Thank you.. but still no luck. I have listed title and description in an array... – sarah Sep 07 '11 at 13:53
1

Try this,

SpannableString content = new SpannableString("hello");
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
txtView.setText(content);
Lalit Poptani
  • 67,150
  • 23
  • 161
  • 242