A: 

use an encode method....it will encode the url for you. It knows what every character maps to....

hvgotcodes
already using it, but the encode function doesn't work, i encode it into UTF-8 but nothing happened, the space character is still there and the server still sending same error. Thx for the reply
Lebriga
there are different types of encoding. UTF-8 is intended to encode Unicode strings for transmission over channels that allow only ASCII characters. URL encoding (which is what both @hvgotcodes and I talk about) is replacing characters that are illegal in URLs with their numerical representation in percent-encodd form (for example space to %20)
Franci Penov
so do you suggest that I encode the value manually? Or there are some encode method in android? I already using it based on some example, but it wont work at all
Lebriga
A: 

Use replaceAll instead of replace.
Although, you should really be doing proper URL encoding. You can use URLEncoder.encode
for example.

Franci Penov
And WMD needs to learn how to properly encode pasted URLs as well...
Franci Penov
What is WMD anyway? Sorry Im a newbie in web programmingIMHO, the replaceAll isn't reversible. I cant read back what I've already send to the web service since the values is already changed drastically (the space character is long gone already)
Lebriga
@Lebriga - ignore the WMD comment. it's the SO text editor Nd it was giving me some trouble with the links.
Franci Penov
If you want to use `replaceAll`, you should just use it instead of `replace` in the sample code in the question. however, there are other characters besides spaces that are not allowed in URLs, hence why you need to use `URLEncoder` class to properly replace all of them.
Franci Penov
well could you give me some example of usage in URL Encoder? i dont know the character format that i should converted to. Moreover i dont really understand about character formatting (UTF-8, etc). Lets say the annoying character that i want to get rid is space character only, could you give the example?~Regards~~English is my 2nd language~
Lebriga
you should specify UTF-8 as the second parameter (the encoding). Here's an example how to use that class: http://www.devdaily.com/blog/post/java/how-encode-java-string-send-web-server-safe-url
Franci Penov
Solved:)thanks a lot for your help Mr. Franci. These are such a great help for me, thanks a lot sir:)
Lebriga
Well, have you considered accepting my answer if it helped you solving your issue? :-)
Franci Penov
Ive been searching for it for an hour but i dont know how to accept your answer, im totally a newbie to stackoverflow
Lebriga
To the left of my answer under the voting control there's a chec mark you can click on to accept the answer.
Franci Penov