2

I want to show an Html formatted text in a list View. I used a TextView in the adapter. this is my code in the adapter :

txtBody.setText(Html.fromHtml(myHtmlString));
txtBody.setLinksClickable(true);
txtBody.setMovementMethod(LinkMovementMethod.getInstance());

the problem is : when I touch a hyperlink on the TextView it crashes with this error in LogCat:

 android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
Ahmad Behzadi
  • 1,006
  • 15
  • 30
  • possible duplicate of [Calling startActivity() from outside of an Activity context](http://stackoverflow.com/questions/3918517/calling-startactivity-from-outside-of-an-activity-context) – duggu Oct 31 '14 at 13:59
  • before asking question please do some searching on google. – duggu Oct 31 '14 at 14:00
  • I do not call the external Activity my self,so I have no intent to set setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) – Ahmad Behzadi Oct 31 '14 at 14:04

1 Answers1

2

Refer this link and link2

It because of context you are setting to your adapter.

Community
  • 1
  • 1
micky
  • 508
  • 5
  • 17