How autolink: working with maps

I use the antroid attribute : autoLink = "map" TextView to navigate to the map and search for the address associated with this text view.

But he behaves rudely and finds only some addresses . Here is the code I'm trying to do:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/textViewautoLink" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/autolinktext" android:autoLink="map"></TextView> </LinearLayout> 

Here is my strings.xml

 strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="autolinktext">1600 Amphitheatre Parkway, Mountain View, CA 94043 </string> </resources> 

Problem:

Suppose I write the line above, i.e. 1600 Amphitheater Parkway, Mountain View, CA 94043, then its working tone and textView turn blue, and when I click onit, it looks for the address on the map.

When I change this address to: 1600 Amphitheater Parkway, Mumbai, IN, it also shows the same and tries to find the address, but since the address is incorrect, he could not find it. Good.

But when I write another address, for example: 600 Band Stand, Mumbai, IN Then

1) textview does not have blue color

2) It does not seem to be available for viewing

3), and since it is not clickable, it does not find the address.

I am looking for google, but I have no reason for this behavior. I also want to know that

Is there any format for writing this card address?

Just like android knows that the address is valid or not, just writing the address in String, since I wrote the same address in the same format, I just changed the line, and the result is that one address can be clicked and the other can not.

Please, help.

+4
source share
1 answer

Below is a comment selected from matches

  • find the number in 1 - 5 digits for the street number (without the support of "One Microsoft Way")
  • ignore if preceded by '#', Suite, Ste, Rm
  • look for two or more words (under 5? North Frank Lloyd Wright)

    note: "The circle on North Hill of St. has six words, and the lower" in "- allows on, by, of, in, and and ...?
  • if the word begins with a lowercase letter, there is no match to allow:,. - # / (for 1/2) '"
  • find one or two separators to represent a possible second line addr and city name
    find either the full name of the state, or specify two letters, and / or a zip code (5 or 9 digits).
  • now look for street suffix, full or abbreviated, with optional 's' if there is an asterisk

Source: CacheBuilder.cpp. For more information, you can check the exact algorithm in CacheBuilder :: FindPartialAddress webviewcore

As far as I can see, only the code of street names ending in LleY, NneX, RCade, VEnue, LAMEDA, aYoU, etc. .... match. In your case, the range stand does not match the end of the street name, which is common in the USA

+8
source

Source: https://habr.com/ru/post/1389777/


All Articles