Sorry, I forgot to say that I am using android-sdk_m5-
rc14_windows...thanks for any help you guys could give me.....



On Mar 27, 4:51 pm, javasurfer <[EMAIL PROTECTED]> wrote:
> I followed the instructions in Dick Wall's tutorial in the Android
> Blog - Linkify your Text.
>
> I wanted to match text in a TextField that looks  like this "[geocode:
> latitude:38.898748, longitude:-77.037684]" and construct a Content URI
> and link for this text that would be used to load an Activity that
> would display a map.
>
> I could not get the links to show up....does anybosy have any idea
> where I could be going wrong.....is there something I am
> missing.......
>
> I am able to get the Linkify.addLinks(TextField, Linkify.ALL) version
> of the method to work OK and show the links but the regex version of
> the method call just does not want to coorporate with me!
>
> The code I used is as follows:
>
>                 String pattern = "\\[geocode:.*latitude:[0-9]+\\.
> [0-9]+,.*longitude:-*[0-9]+\\.[0-9]+]";
>         Pattern geocodeMatcher = Pattern.compile(pattern);
>         String geocodeViewURL = "content://
> com.threespaces.android.browser/geocode/";
>         Linkify.addLinks((TextView)findViewById(R.id.userfield2),
> geocodeMatcher, geocodeViewURL, new geocodeMatchFilter(), new
> geocodeTransform());
>
> //inner classes
>     public class geocodeTransform implements TransformFilter {
>         public String transformUrl(Matcher match, String url) {
>                 int startLatitude = match.group().indexOf("latitude:", 0) + 9;
>                 int endLatitude = match.group().indexOf(",", startLatitude);
>                 String latitude = match.group().substring(startLatitude,
> endLatitude);
>
>                 int startLongitude = match.group().indexOf("longitude:", 0) +
> 10;
>                 int endLongitude = match.group().indexOf("]", startLongitude);
>                 String longitude = match.group().substring(startLongitude,
> endLongitude);
>
>                 return latitude + "/" + longitude;
>         }
>     }
>
>     public class geocodeMatchFilter implements MatchFilter {
>         public boolean acceptMatch(CharSequence s, int start, int end) {
>                 return true;
>         }
>
>     }
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to