Search code examples
androidhyperlinktextviewclickable

Error While clickng on TextView Hyperlinks


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?

Solution

  • Refer this link and link2

    It because of context you are setting to your adapter.