我使用下面的代码作为listview和textview.
码:
textcontent.setText(Html.fromHtml(item.get_text()));
textcontent.setAutoLinkMask(Linkify.WEB_URLS);
Run Code Online (Sandbox Code Playgroud)
XML:
<TextView
android:id="@+id/txtview"
android:autoLink="web"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="put your link here"/>
Run Code Online (Sandbox Code Playgroud)
链接看起来像url,我可以单击它但它会生成此异常
android.util.AndroidRuntimeException:从Activity上下文外部调用startActivity()需要FLAG_ACTIVITY_NEW_TASK标志.
任何想法如何解决这个问题?
Fed*_*dor 10
不要将应用程序上下文传递给ListAdapter构造函数.通过您的主要活动.
ListAdapter flareAdapter = new ListAdapter(LayoutInflater.from(activity), Items);
Run Code Online (Sandbox Code Playgroud)
即使您在其他类中创建适配器,您仍应传递主要活动参考.