Available links in listview list

View a list of click links.

I use the following code inside getView () to create a clickable link in a list.

myTextView.setMovementMethod(LinkMovementMethod.getInstance());
String linkText = "<a href=\"http://www.google.com\">Google</a>";
myTextView.setText(Html.fromHtml(linkText));

This code works fine in text mode, which is not in the list, but when I use it for text viewing in the list view, when I click on the link, the following exception appears.

AndroidRuntimeException: Calling startActivity() from outside of an Activity
context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
+3
source share
3 answers

Got an answer here . I just had to change the constructor call from

CustomAdapter mAdapter = new CustomAdapter( mContext, itemList);

to

CustomAdapter mAdapter = new CustomAdapter( this, itemList);
+7
source
   TextView textView2 = (TextView)findViewById( R.id.TextView2 );
   SpannableStringBuilder ssb = new SpannableStringBuilder( http://google.com" );
   textView2.setText( ssb, BufferType.SPANNABLE );
   Linkify.addLinks( textView2, Linkify.WEB_URLS );

     Try this one....
0
source

, ApplicationContext . ActivityContext, !

0

All Articles