Hi,

Short version: I'm unable to see how you'd launch an auto-linked
intent (in this case, URL view) from a widget/remote-view without
being able to specify the required flag.

Long version: I'm creating a widget which, among other things,
displays tweets which may contain URLs. By setting the textview text
using the remoteview's setTextViewText method I can specify the text
and then use the android:autoLink and android:linksClickable
attributes of the TextView in the layout to ensure these links are
formatted correctly, highlighted and clickable.
However, clicking the link throws the following exception:
[code]
E/AndroidRuntime(  341): FATAL EXCEPTION: main
E/AndroidRuntime(  341): android.util.AndroidRuntimeException: Calling
startActivity() from outside of an Activity  context requires the
FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
E/AndroidRuntime(  341):        at
android.app.ContextImpl.startActivity(ContextImpl.java:617)
E/AndroidRuntime(  341):        at
android.text.style.URLSpan.onClick(URLSpan.java:62)
[/code]
While I understand the meaning of the message - that it's impossible
to launch an activity without specifying either an origin Activity
(which the widget's remoteview won't have a reference to) or without
specifying the FLAG_ACTIVITY_NEW_TASK flag - I can't change the former
and I don't see any way of intercepting the auto-link features Intent
to specify the flag.
I've seen widgets that contain seemingly normal URIs so I know it's
entirely possible (unfortunately none that are open-source) and so I'm
slightly stumped.

Any help would be much appreciated.

Ryan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to