1

I have an Httpget request which send address of a person to the server. Once it reach at server i will receive a confirmation message as Success. I have given a toast message to print the received string. I am getting the toast message while I am typing a line without space. But the problem is that, when I am giving a sentence including space it is getting error forcefully closing the emulator.

The error showed in the logcat is as follows:

 06-21 15:01:10.083: E/AndroidRuntime(513): java.lang.IllegalArgumentException: Illegal character in query at index 53: http://r4m.co/android/api.php?type=10&maintainance=Mohammed Shehnad.b

Can anybody give a suggestion for my problem..

Pranav Singh
  • 17,079
  • 30
  • 77
  • 104
Shehnad
  • 11
  • 1

1 Answers1

2

You can escape your request parameter using :

import java.net.URLEncoder;

URLEncoder.encode(string, charsetName);