1

In my android application, upon clicking a link I have to open up google maps page. In google maps I am prepopulating the source and destination address. Source address is my current location and destination address is a predefined one. My destination address contains '&'. So while loading the google maps, the destination address comes only till this '&'.

Suppose the address is: ABC & Co.

In google maps it comes only till ABC as destination address. The rest '& Co.' is not shown.

Why is it so?

Please help me out. Thanks in advance.

Anju
  • 9,379
  • 14
  • 55
  • 94

2 Answers2

2

Have you tried formatting it with

String query = URLEncoder.encode("ABC & Co.");

before using it in your URL? This essentially does what you are doing in your answer but it will work on any string.

URL encoding in Android

Community
  • 1
  • 1
skynet
  • 9,898
  • 5
  • 43
  • 52
  • what is the rawStr? When I entered my address over there its showing error...its saying it should be List extends NameValuePair> – Anju Nov 14 '11 at 06:12
  • My bad, I did give you the wrong method. That was for encoding parameter pairs. I've updated my answer with the correct way to do this. – skynet Nov 14 '11 at 13:50
0

I got it worked. Give the URL escape character for '&'. Its value is %26

Anju
  • 9,379
  • 14
  • 55
  • 94