The text view is simpler, and 100x more efficient than using a web view. Unless you need the complicated markup of a web view, it is really best to use a text view. You can look at the Linkify code as an example of how to create your own links:
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/text/util/Linkify.java<http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/text/util/Linkify.java;h=d61e888e18158fa0242912925162f8ea03ae0ce5;hb=HEAD> On Sun, Sep 6, 2009 at 3:34 PM, Ken H <hunt1...@gmail.com> wrote: > > Jason, > > It took a little work and reading but you were right. The trick was > replacing the markup tags like <ahref="LINKNAME"> with <a > href="LINKNAME">. That and using the setWebViewClient > WebView method. > > I tried using TextView's like some guys suggested, but that was > getting way too complex (more so when you compare it to using this > WebView widget). > > Thanks again! > > Ken > > On Sep 4, 3:32 pm, Jason Proctor <jason.android.li...@gmail.com> > wrote: > > hey Ken, > > > > WebViews can do anything TextViews can, you just have to format the > > contents as legal HTML to get the right things to happen. depending > > on the features you want, this might be as easy as wrapping > > everything with <html><body>YOUR STUFF HERE</body></html>. but one > > complication is that IIRC webviews won't auto-detect links in regular > > text, they need to be marked up with anchor tags. if your links are > > embedded then this might be work for you. > > > > however, once you get this sorted out, then you can register a > > WebViewClient with your WebView, whose shouldOverrideUrlLoading() > > will get called when someone clicks on a link. you can then decide > > what to do, and whether the WebView sees the link after you do. > > > > this mechanism enables all kinds of crazy stuff to happen. i use it > > to preprocess HTML before the WebView sees it, or hand links off to > > Android activities for native handling, etc. most anything can be > > done. > > > > it's pretty straightforward. > > > > hth > > J > > > > > > > > > > > > >Jason, > > > > >Thanks for the response. This is turning into a *thing* now. I'm > > >starting to think it can't be done or there is a serious bug in > > >Android that won't let it work. > > > > >But my question now is, can I use a webview like a textview? I have a > > >textview I use as a 'title bar' header, and another textview below > > >scrolls in a scrollview. I assume I can do things like that. But what > > >about building the contents? I use a textview because I have tons of > > >data in a string-array that I insert in the textview. Is there some > > >site that is a good primer on building an html page in a webview on > > >the fly in android? > > > > >Ken > > > > >On Sep 3, 11:21 am, Jason Proctor <jason.android.li...@gmail.com> > > >wrote: > > >> i'm not sure whether this is possible in a TextView, but in a > > >> WebView, you can override the handling of clicks on URLs and do > > >> pretty much whatever you like. > > > > > > check out WebViewClient.shouldOverrideUrlLoading(). > > > > >> >Is it possible to use a hyperlink in android to do something other > > >> >than open a web page? I want to use a hyperlink in a TextView to > > >> >luanch a new activity, or something along those lines. I have a > large > > >> >document and I want to let the user jump to references within the > doc > > >> >(like a footnote or something). Can this be done? > > > > >> >Ken > > > > >> -- > > >> jason.vp.engineering.particle > > > > -- > > jason.vp.engineering.particle > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---