Hi,

i tried to make a textview with clickable url links. It's blocked, but
only if I
preset the text e.g. like  ..android:text="www.google.de".. then the
view
is clickable (on view startup the text will be overwitten by my
program, so
it's invisible):

program.xml:
-------------------
...
<TextView android:id="@+id/urlresult"
     ...
    android:autoLink="all"
     ...
    android:text="www.google.de"  <-- only for testing
/>

program.java:
------------------
...
private String myUrl = "";
...
public void onCreate(Bundle icicle) {
       ...
       TextView tv = (TextView)findViewById(R.id.urltextview);

       String myDisplayString = getTextToDisplay();   //
myDisplayString contains no url

       tv.setText( myDisplayString, TextView.BufferType.SPANNABLE );
       SpannableString myString = (SpannableString)tv.getText();

       myString.setSpan(new URLSpan( myUrl ),
                      pos1, pos2, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
}

private String getTextToDisplay() {
       ... myUrl = "<a valid url is put here>"; ...
       return displayText;
}

How can I solve this mysterious behavior without presetting the text
value in the layout file ?

CU
--~--~---------~--~----~------------~-------~--~----~
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