I have an app widget with a TextView
in it. I set its android:autoLink property to "web" so that the links can be clicked to launch them in browser.
The links become clickable alright, but when I click on them an exception is thrown while opening the browser Activity.
10-31 01:27:56.155: E/Nova.AppWidget(9427): com.capturekenya/.CaptureWidgetProvider v1.0 (1): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
10-31 01:27:56.155: E/Nova.AppWidget(9427): at android.app.ContextImpl.startActivity(ContextImpl.java:1026)
10-31 01:27:56.155: E/Nova.AppWidget(9427): at android.app.ContextImpl.startActivity(ContextImpl.java:1013)
10-31 01:27:56.155: E/Nova.AppWidget(9427): at android.content.ContextWrapper.startActivity(ContextWrapper.java:284)
10-31 01:27:56.155: E/Nova.AppWidget(9427): at android.text.style.URLSpan.onClick(URLSpan.java:64)
10-31 01:27:56.155: E/Nova.AppWidget(9427): at android.text.method.LinkMovementMethod.onTouchEvent(LinkMovementMethod.java:212)
This is the TextView in the widget
<TextView
android:id="@+id/notification_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/calendar_textView"
android:layout_marginTop="8dp"
android:autoLink="web"
android:ellipsize="end"
android:gravity="center"
android:text="@string/notification"
android:textColor="@color/white"
android:textSize="12dp" />